On Wed, Dec 7, 2011 at 6:21 PM, Russell Keith-Magee <russ...@keith-magee.com > wrote:
> I don't consider it a bug > that Django exposes a database error in this case. > I didn't hear what sounded like a database error in this case. The original note says: Upon attempting to save, you'll receive an error message stating, "Production with this Person and Title already exists." That sounds like pre-save validation refusing to attempt to save because it believes an IntegrityError will be raised. I haven't checked the code but I wouldn't be surprised if the unique validation works by checking for an existing dupe among the other submitted/modified inlines and the db, excluding just the pk of what it is currently attempting to verify will not be a dupe with its new values. That approach would flag this direct swap case as a validation error. Whether that's a bug, I'm not convinced. While it is true that the final state here won't violate the unique together constraint, the intermediate state of getting there, given initial state, WILLL violate the unique together constraint. There's no way (I don't think, though I could be wrong) for the unique checking code to know if current to final state is going to be done in a single transaction (nor whether the DB in use is going to support deferring the constraint checking to the end of the transaction). Seems to me safest thing for the unique validation code to do is raise the validation error here. Karen -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.