Monday, September 22, 2014

Error UNIQUE constraint failed with Django 1.7

I got error (Error UNIQUE constraint failed) when tried create an object with create function. Many websites post the solution is update sequence of database, but the problem isn't solved. I had this code:

TutorUser.objects.create(
            user
=user,
            birthdate
=date_obj,
            name
=request.POST['name'],
            usertype
="tutor")



I solved the problem, changing to this:

tu = TutorUser(
            user
=user,
            birthdate
=date_obj,
            name
=request.POST['name'],
            usertype
="tutor")
tu
.save()



The question is ... ¿is that a bug of Django 1.7?



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fe117278-5350-4d90-8566-73844347108e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment