On Thu, Mar 25, 2010 at 4:23 PM, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > No, he's not, because Kenneth said that the instance exists. In your
Actually, he described both situations where the instance exists, but with different values for the non-key attributes of the model, and where the instance doesn't exist. pedant++ > example, the instance doesn't exist and thus a new object is attempted > to be created. The restrictions at that point are the same as when > creating a new object from scratch, as noted in my reply. The caller of > get_or_create() will always know what the various constraints are on the > model and must allow for that in their code. > > Regards, > Malcolm > > Well, quite. His problem was that he wasn't allowing for the constraints in his code because he was unaware of the 'defaults' kwarg to get_or_create(). With that addition, his problems when an instance with the same unique key exists, and when no instance exists are both fixed. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.