0👍
✅
I have found the problem !
user = User.objects.create_user(username=username, password=password)
user.userprofile.status = status
user.save()
When I do that, i suppose user = User.objects.create_user(username=username, password=password)
returns an user (false).
So, I have to make a request :
user = User.objects.create_user(username=username, password=password)
test = UserProfile.objects.filter(user=username)
test.status = status
test.save()
And it is ok !
2👍
Your definition of your status
field is incorrect.
CharFields require a “max_length” attribute that is a positive integer.
Change it to the following:
models.CharField(max_length=..., choices=STATUS_CHOICES)
See also here
- [Answered ]-'Command' object has no attribute 'stdout'
- [Answered ]-What is the best approach to keep many different django model type choices DRY?
- [Answered ]-Django symmetrical ManyToMany field on 2 columns
Source:stackexchange.com