Hi,

Yes, I am adding instances via the admin.

I suspected the field not being on the form was the cause of there
being no nice error message. Thanks for confirming this.

I guess to best (and only?) way to deal with this now is to add my own
validation to the form clean() method and inform the user myself?

Michiel

On Oct 6, 6:16 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Tue, Oct 6, 2009 at 11:44 AM, Michiel <michiel.detaill...@gmail.com>wrote:
>
>
>
>
>
> > Hi,
>
> > I'm getting an unhandled IntegrityError after setting a
> > unique_together over a DateField and a SlugField, is that considered a
> > bug or not?
>
> > I expected it to show a nice error message informing the user that he
> > should pick something else for either Date or Slug. I does do that
> > when I set the unique_together over the 'title' and the 'title_slug'
> > SlugField.
>
> > DateField is auto_now_add=True, could that have something to do with
> > it? Also: I'm using sqlite3.
>
> (I assume you are talking about adding instances via the admin?)
>
> Yes, auto_now_add has something to do with it.  auto_now_add=True means the
> value of the field is not present in the form. Uniqueness checking is done
> during form validation, and only checks values that are present in the
> form.  Thus if a field value not present in the form is going to cause a
> uniqueness violation it won't be detected by the unique check.
>
> Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to