django

Django: Displaying formset errors correctly

I have an inline formset for a model, which has a unique_together constraint. And so, when I input data, which doesn't fulfill this constraint, it displays: __all__Please correct the duplicate values below. The code, which does this is: {% for error in formset.errors %} {{ error }}<br/> {% endfor %} I don't much like...

Django custom form validation best practices?

I have a form that contains 5 pairs of locations and descriptions. I have three sets of validations that need to be done you need to enter at least one location for the first location, you must have a description for each remaining pair of locations and description After reading the Django documentation, I came up with the following...

How to create a unique_for_field slug in Django?

Django has a unique_for_date property you can set when adding a SlugField to your model. This causes the slug to be unique only for the Date of the field you specify: class Example(models.Model): title = models.CharField() slug = models.SlugField(unique_for_date='publish') publish = models.DateTimeField() What would be the...

pinax ImportError cannot import name UserOpenidAssociation

i have these errors ImportError at / cannot import name UserOpenidAssociation i could make any sense out of the traceback equest Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.1.1 Python Version: 2.6.1 Installed Applications: ['inventory.inlanddbase'] Installed Middleware: ('django.middleware.common.CommonMiddleware'...

Django site with lots of drill down options. How to effectively write the urls.py?

I am making a django site to showcase children's clothing. You start with an overview page where you see a listing with all the clothes. In a side bar you have the following options to refine your search: clothes for: boys girls clothes in: cotton wool clothes in size: 56 62 68 74 80 86 92 98 104 110 116 clothes with the...

Django ORM: SELECT on field attributes

Hello everyone, I have a model that contains a FileField. I want to search for a specific filename. How do I do it? I was trying: MyModel.objects.get(document__name=FOO) I got a Join on field 'document' is not permitted. Thanks! ...

django error ,about django-sphinx

from django.db import models from djangosphinx.models import SphinxSearch class MyModel(models.Model): search = SphinxSearch() # optional: defaults to db_table # If your index name does not match MyModel._meta.db_table # Note: You can only generate automatic configurations from the ./manage.py script # if your index name...

Django: 535, 'Incorrect authentication data' for SMTP

Hi, I'm running Ubuntu 9.1 and Django 1.1.1. I am trying to connect to an outside SMTP server to send mail, and the connection has worked for several days and has sent many a message without a problem. All of the sudden, I am receiving: "535, 'Incorrect authentication data'" ... when using the send() method on EmailMessage objects. ...

Django query filter, passing a date results in an invalid SQL syntax

z = Pokes.objects.filter( pokestiming__when_start__lte=datetime.now(), pokestiming__when_end__gte=datetime.now(), pokestiming__next_poke__lte=datetime.now(), poke_deleted=0, poke_operating=1, ) That's a query I'm using. It selects any Poke object, with a PokesTiming object (foreign key) within the date ranges. It's...

django error when i use django svn version.

this code: class TribeForm(forms.ModelForm): slug = forms.SlugField(max_length=20, help_text = _("a short version of the name consisting only of letters, numbers, underscores and hyphens."), error_message = _("This value must contain only letters, numbers, underscores and hyphens.") ) def clean_slug(sel...

Django order_by a related _set

I have a model for our customers and a model for their purchases/orders. In our backend/web admin, we want to be able to sort the customer list by their most recent order. Here is basically what our models look like class Customer(models.Model): username = models.CharField(max_length=32) first_name = models.CharField(max_length...

Problem deploying Django-Mingus with Flup and Cherokee. Strange admin behaviour.

I have a django-mingus blog running perfectly fine with the integrated development web server of django. It's installed in a virtualenv. Once deployed using the django app wizard of cherokee 0.99.42 the admin pannel is displaying a strange behaviour. Sometimes all apps are displayed in the admin pannel sometime only a subset of the apps...

PostgreSQL problem in Django

I have a Django application and I'm using postgres. I try to execute the bollowing line in one of my tests: print BillingUser.objects.all() And I get the following error: "current transaction is aborted, commands ignored until end of transaction block." My postresql log: ERROR: duplicate key value violates unique constraint "...

Django model overview: show more than 100 items?

In one of the models overview panel, after I filter the items by month, I have to select them all and then create a document with information regarding them (kind of like a monthly report). This is a problem when one month has more than 100 items as Django paginates the filtering results. Is there a way to increase the number of items s...

What makes an effective URL Mapping implementation and why?

I am looking at implementing URLMapping for a personal project. I am already aware that solutions exist so please do not answer suggesting I should use one. What I want is to harvest the opinions of fellow developers and web users on URL mapping implementations. Specially I would like you to answer: Which is your favourite implementa...

Pydev configuraiuon to specify generated variables

I am using Pydev with Django which marks Django generated variables as errors, eg User.DoesNotExist. In pylint I can specify a setting called generated variables. Is there such a setting in Pydev? ...

django template exceptions handling

All, There is a template say x.html its contes are <form action ="/lookinto/a"> <p >name:</td><td> <input type="text" id=name" name="name"></input></p></tr> <tr><td> <p >Section:</td><td> <input type="text" id="section" name="section"></input></p></td></tr> </form> My question is that when handling,/lookinto/a if i have an exception...

Django admin authentication failure

Hi folks, logging into django admin fails when 'log in' button is pressed first time, but pressing "back" and "log in' again - logs the user in successfully. I am deploying Django app with zc.buildout here, with a setup similar to what is described here http://www.meppum.com/2009/jan/17/installing-django-ubuntu-intrepid/. Nginx (listen...

Can Django ORM do an ORDER BY on a specific value of a column?

I have a table 'tickets' with the following columns id - primary key - auto increment title - varchar(256) status - smallint(6) - Can have any value between 1 and 5, handled by Django When I'll do a SELECT * I want the rows with status = 4 at the top, the other records will follow them. It can be achieved by the following query: sel...

Difference between django-openid and django-openid-auth ?

I found two python libs to perform openid authentication with django: django-openid and django-openid-auth. I don't get the difference between the two, mostly (I think) because I have no experience with the django authentication mechanisms. ...