Hello. I noticed a weird problem with the order of parameters specified
in unique_together for a Meta class inside another class. I have the
following definitions:

class Obligation(models.Model):
    organization = models.ForeignKey(Organization)
    name = models.CharField(maxlength=80)

    class Meta:
        unique_together = (("organization", "name"), )

with an add_obligation view that follows the template style discussed in
the documentation (POST and GET all in one). The associated template
looks like:

<form method="post" action="">
  <table>
    <tr><td>Name:</td><td>{{ form.name }} {% if form.organization.errors
%}*** {{ form.organization.errors|join:", " }}{% endif %}</td></tr>
  </table>
  <input type="submit" value="Add Obligation" />
</form>

With the above code, trying to create a duplicate Obligation results in
an error message on the user's browser ("*** Obligation with this
organization already exists for the given name."). However, if I swap
the values in unique_together to (("name", "organization"), ), the same
action produces a Django error regarding duplicate entries in the database.

I've tried creating the objects in the console, and both variations of
unique_together produce the same database error (duplicate entry). It
seems like the Manipulator responsible for Obligation catches the error
in one case, but doesn't see it in the other.

Has anyone seen this before? I would greatly appreciate any help. Thanks!

Nick Fishman

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to