My problem is specifically with the admin site Thanks
On Mon, Jul 14, 2008 at 11:55 AM, rui <[EMAIL PROTECTED]> wrote: > I had to come around this doing in the start of the code: > > from django.db import transaction > > And after the IntegrityError is catched (with a try/except block): > > transaction.rollback() > > Like: > try: > user.save() > except IntegrityError, e: > transaction.rollback() > > Sorry but i don“t have experience with the admin-app to help you on > this, but this did the trick for me. > > Cheers. > -- > Rui > http://ruivaldo.blogspot.com > > > On Mon, Jul 14, 2008 at 6:23 AM, Alex Rades <[EMAIL PROTECTED]> wrote: >> >> Hi, >> I'm using latest newforms-admin and I have a simple model which is: >> >> class Backend(models.Model): >> name = models.CharField(unique=True, max_length=255) >> address = models.IPAddressField() >> >> class Meta: >> db_table = u'backend' >> ordering = ('name',) >> >> In the admin, when I try to add a new object with a name which is >> already present, the unique=True constraint doesn't work as expected, >> the error is: >> >> IntegrityError at /admin/models_app/backend/add/ >> duplicate key value violates unique constraint "backend_name_key" >> >> >> Basically, it seems the admin site doesn't handle unique >> constraints...do you have suggestions? >> >> Thanks >> >> > >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

