I have 3 fields that need to be unique together: office, county and
case_no. In the "Case" model, I have the following:

--
class Case(models.Model):
  office = models.ForeignKey(Office, editable=False)
  county = models.ForeignKey(County)
  case_no = models.CharField(max_length=20)
  ...

  class Meta:
    unique_together = ("office", "county", "case_no")

--

Using forms, when I try to submit a duplicate I get a nasty 500 error:
"duplicate key violates unique constraint..." rather than a form
error.

This is a new constraint I added to the database and am trying to get
django to recognize it.
--~--~---------~--~----~------------~-------~--~----~
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