django

Getting stuck at Django error: No module named registration

I installed the registration module, added it to settings.py. When I tried to run syncdb (% python sitename/manage.py syncdb --settings sitename.devsettings) It gave me "Error: No module named registration" The same setup works (using the same files for everything) fine on the server. This happens on my local machine running OS X. I...

Form Validation in Admin with Inline formset and Model form

I have a model, OrderedList, which is intended to be a listing of content objects ordered by the user. The OrderedList has several attributes, including a site which it belongs to. The content objects are attached to it via an OrderedListRow class, which is brought into OrderedList's admin via an inline formset in the admin. class Orde...

Django haystack and whoosh

Does anyone have any experience using django-haystack with the whoosh backend? I'm looking to use it for a categorized live-search type tool. Is it gonna be fast/efficient enough in a production environment to avoid setting up either solr or xapian? ...

on windows with django i get a WindowsError (3, 'The system cannot find the path specified')

this is particularly at this line: filesys = os.listdir(settings.CAPTCHA_ROOT) it happens when trying to read or write to a directory. any ideas why it would do this only under Windows? edit --------------------------------------- def __clean_captchas(self, offset=3600): """docstring for __clean_captchas""" filesys...

Specifying Django Related Model Sort Order

I have Django models that are lists of items and I want the items on each list to have a separate sort order. Maybe list 1 will sort line items by name, list 2 by date, and list 3 by priority. The models looks more or less like this: class ListItem(models.Model): priority = models.IntegerField(choices=PRIORITY_CHOICES) name = ...

Do you version control the invidual apps or the whole project or both?

OK, so I have a Django project. I was wondering if I'm supposed to put each app in its own git repository, or is it better to just put the whole project into a git repository, or whether I should have a git repo for each app and also a git repo for the project? Thanks. ...

Installed apps in Django - what about versions?

After looking at the reusable apps chapter of Practical Django Projects and listening to the DjangoCon (Pycon?) lecture, there seems to be an emphasis on making your apps pluggable by installing them into the Python path, namely site-packages. What I don't understand is what happens when the version of one of those installed apps chang...

How do I allow users to map their domains to a url on my site?

How do I allow users to map their domains to a url on my site? (like how tumblr or blogger does) The app is being developed in Django. I want the users to be able to map their domains to mydomain.com/username (is this possible or do I need to have a format like username.mydomain.com?) Also my app runs on a VPS so I have my nameservers ...

fetching row numbers in a database-independent way - django

Let's say that I have a 'Scores' table with fields 'User','ScoreA', 'ScoreB', 'ScoreC'. In a leaderboard view I fetch and order a queryset by any one of these score fields that the visitor selects. The template paginates the queryset. The table is updated by a job on regular periods (a django command triggered by cron). I want to add a...

How to agnostically link any object/Model from another Django Model?

I'm writing a simple CMS based on Django. Most content management systems rely on having a fixed page, on a fixed URL, using a template that has one or many editable regions. To have an editable region, you require a Page. For the system to work out which page, you require the URL. The problem comes when you're no longer dealing with "p...

django form

is anybody know how to log the username who is currently loged in in form.py ...

south migration error app "is not available in this migration"

This problem is basically the same as the previous question here. However, the answer there does not work for me. I've installed the trunk version of south, manually entered the import line in the migration file in question, and done a full 'startmigration' in a separate directory and examined the 0001_initial.py file. I have a Django ...

Testing for mysterious load errors in python/django

This is related to this http://stackoverflow.com/questions/926579/configure-apache-to-recover-from-modpython-errors, although I've since stopped assuming that this has anything to do with mod_python. Essentially, I have a problem that I wasn't able to reproduce consistently and I wanted some feedback on whether the proposed solution see...

Django: overriding 'unoverridable' admin templates per app instead of per project?

The Django documentation states the following clearly: Not every template in contrib\admin\templates\admin may be overridden per app or per model. It then lists the ones that can, and base.html, base_site.html and index.html – the ones I'm interested in – are not among those listed. They can be overridden per-project, but not per-a...

Interfacing web crawler with Django front end

I'm trying to do three things. One: crawl and archive, at least daily, a predefined set of sites. Two: run overnight batch python scripts on this data (text classification). Three: expose a Django based front end to users to let them search the crawled data. I've been playing with Apache Nutch/Lucene but getting it to play nice with ...

django orm, how to view (or log) the executed query?

Hi folks, Is there a way I can print the query the Django ORM is generating? Say I execute the following statement: Model.objects.filter(name='test') How do I get to see the generated SQL query? Thanks in advance! ...

jquery checkbox alert

I've inherited the following checkbox: <td><div class="text_note"><label for="terms" class="text button_action"> <input type="checkbox" name="terms" id="terms" onClick="checkCheckBox(this, 'inf_terms', true)"> &nbsp;I understand and agree to the Terms &amp; Conditions. </label>&nbsp;<span id="inf_terms">&nbsp;</span></div></td> I need...

Django conditional aggregation

Does anyone know of how I would, through the django ORM, produce a query that conditionally aggregated related models? Let's say, for example, that you run a site that sells stuff, and you want to know how much each employee has sold in the last seven days. It's simple enough to do this over all sales: q = Employee.objects.filter(type...

Django - Website Home Page

I've been having a look at Django and, from what I've seen, it's pretty darn fantastic. I'm a little confused, however, how I go about implementing a "home page" for my website? Would it be a separate app, or just a view within the project, or what? ...

Django - Perform Raw SQL Update/Delete and return row count

Going off the documentation here: http://docs.djangoproject.com/en/dev/topics/db/sql/ >>>cursor = connection.cursor() >>>cursor.execute("UPDATE bar SET foo = 1 WHERE baz = %s", [self.baz]) >>>print cursor.fetchone() None Does anyone know how to return the modified row count? (NOTE: I've played around with the placement/order of trans...