django

Problem with Python modules

Hi! I'm uploading my first Django app to my Dreamhost server. My app uses xlwt package and since I can't install it in the default location ( /usr/lib/python2.3/site-packages/xlwt ), I installed it on another location by: python setup.py install --home=$HOME Then xlwt is installed here: /home/myuser/lib/python/xlwt/ After that, I ...

suggestions for a daemon that accepts zip files for processing

im looking to write a daemon that: reads a message from a queue (sqs, rabbit-mq, whatever ...) containing a path to a zip file updates a record in the database saying something like "this job is processing" reads the aforementioned archive's contents and inserts a row into a database w/ information culled from file meta data for each f...

How do you put a file in a fixture in Django?

I can easily fill the field of a FileField or ImageField in a Django fixture with a file name, but that file doesn't exist and when I try to test my application it fails because that file doesn't exist. How do I correctly populate a FileField or Imagefield in a Django fixture so that the file itself is available too? ...

Map raw SQL to multiple related Django models

Due to performance reasons I can't use the ORM query methods of Django and I have to use raw SQL for some complex questions. I want to find a way to map the results of a SQL query to several models. I know I can use the following statement to map the query results to one model, but I can't figure how to use it to be able to map to relat...

add request to django model method?

I'm keeping track of a user status on a model. For the model 'Lesson' I have the status 'Finished', 'Learning', 'Viewed'. In a view for a list of models I want to add the user status. What is the best way to do this? One idea: Adding the request to a models method would do the trick. Is that possible? Edit: I meant in templatecode: {{ ...

What to cover in a django introduction talk?

I am taking a session on web application development using django at a local Open Source Community. The audience has earlier programming experience in Java or C; Some people with php and .net. What all should I talk about. Hardly anybody would be familiar with dynamic languages. How to cover essential topics of Python? Are there any ...

Django Snippets Required

Hey guys, I'm a really tight schedule to code up a prototype for a website. I'm working with Django and am just starting out. Can you suggest open source Django snippets for the following: 1) A User Registration system (Registration/Authentication/Sessions) 2) A Rating System (Preferably a x/10 or 5 stars rating system) 3) A tags bas...

Django QuerySet order

Hi, I am new to both django and python but I am beginning to get a grasp on things. I think. I have this problem and I can not seem to find an answer to it. (Though I assume it is really simple and the limiting factors are my google skills and lack of python/django knowledge) The scenario: a user can opt in to recieve temporary job op...

How to get the label of a choice in a Django ChoiceField?

I have a ChoiceField, now how do I get the "label" when I need it? class ContactForm(forms.Form): reason = forms.ChoiceField(choices=[("feature", "A feature"), ("order", "An order")], widget=forms.RadioSelect) form.cleaned_data["reason"] would only give me "...

Active Directory - Django/Rails

I'm thinking about re-writing a web app in Django or Rails and wondering about authenticating against AD. Is one ecosystem better suited for this (libraries, etc) or is it a toss-up? (The app will be hosted on Linux) I have lots of reasons for the re-write, one them is to make myself more marketable. Anyone care to comment on the whic...

Django Template: Comparing Dictionary Length in IF Statement

I am trying to compare the length of a dictionary inside a django template For example, I would like to know the correct syntax to do the following: {% if error_messages %} <div class="error"> {% if length(error_messages) > 1 %} Please fix the following errors: <div class="erroritem"> {% for key, value in error_messa...

Overriding class member variables in Python (Django/Satchmo)

I'm using Satchmo and Django and am trying to extend Satchmo's Product model. I'd like to make one of the fields in Satchmo's Product model have a default value in the admin without changing Satchmo's source code. Here is an abbreviated version of Satchmo's Product model: class Product(models.Model): site = models.ForeignKey(Site,...

How do i convert WMD markdown syntax to HTML on my site?

Am using django and am implementing WMD on my site, am just wondering how do i convert the markdown syntax to HTML for display purposes, is there some sort of function i should call to do this conversion? What is the best way to handle markdown ie. do i save the markdown as is to the database then parse it when displaying it or should i...

Auto GET to argument of view

some_view?param1=10&param2=20 def some_view(request, param1, param2): Is such possible in Django? ...

Priority issue in Sitemaps

I am trying to use Django sitemaps. class BlogSiteMap(Sitemap): """A simple class to get sitemaps for blog""" changefreq = 'hourly' priority = 0.5 def items(self): return Blog.objects.order_by('-pubDate') def lastmod(self, obj): return obj.pubDate My problem is..I wanted to set the priority of f...

nginx + FastCGI for django application---run two webservers or one?

I'm about to deploy a Django application on a nginx web server, and want to make sure I'm building the system correctly. It seems to be common wisdom that if you are deploying Django on an apache server, then you should still put an nginx server in front of the application to serve static files, at which nginx is more performant. If in...

Trying to get enum style choices= working for django but the whole tuplets are appearing in the drop down

Im using appengine and the appenginepatch (so my issue could be related to that) I have set up a model with a property that has several choices but when trying to display on a form or via admin interface I am getting an error: Property mode is 'o'; must be one of (('s', 'Single'), ('m', 'Multi'), ('o', 'Ordered')) This is my code...

Place for Django classes

Hi! I have a little noob (and perhaps trivial) question. Where I should put my Django classes (not from Model)? I mean, my model classes are defined in myapp/models.py but I want, for example, use the syndication feed framework to write a simple feed. The doc says that I need to write a Feed class but... where I should put the code? wh...

How do I modify sys.path from .htaccess to allow mod_python to see Django?

The host I'm considering for hosting a Django site has mod_python installed, but does not have Django. Django's INSTALL file indicates that I can simply copy the django directory to Python's site-packages directory to install Django, so I suspect that it might be possible to configure Python / mod_python to look for it elsewhere (namely ...

Standard Django way for letting users edit rich content

I have a Django website in which I want site administrators to be able to edit rich content. Suppose we're talking about an organizational info page, which might include some pictures, and some links, where the page is not as structured as a news page (which updates with news pieces every few days), but still needs the ability to be easi...