8👍
Try to
user = models.OneToOneField(User, null=True, blank=True)
And then recreate your db.
You can find more on https://docs.djangoproject.com/en/1.4/ref/models/fields/#null
Else you can use Proxy models:
class UserExtraInfo(User):
#here your extra fields
In this case you won`t need to create UserExtraInfo instance in same time with User.
Read more on https://docs.djangoproject.com/en/1.4/topics/db/models/#model-inheritance
0👍
Integrity error occurred basically when you define some database field as not null and pass
the null or blank value
I am assuming you are storing the value in your database by django form
so in that case you can do like
if request.method == POST:
# whatever the method
get_form_obj = form.save(commit = False)
Don’t forget to make change in your model user field like (null = True,blank = True)
hope this will help
- [Django]-Changing package install order in Python
- [Django]-Google Analytics reports API – Insufficient Permission 403
- [Django]-Django Generated polish plurals form in .po file not working
- [Django]-Django rest framework unique together error message not displayed anymore
0👍
For me it was depth = 1 in serializers.py, just remove this part and the request goes through. Nested serializers were causing the problem because of this (in console it was showing NestedSerializer(read_only=True):)
- [Django]-Django Rest Framework update() with kwargs from validated_data
- [Django]-Where to you monkey patch the Django user model?
- [Django]-Using mongoengine with models.ImageField
- [Django]-How to avoid django "clashes with related m2m field" error?
- [Django]-Return object when aggregating grouped fields in Django