Closed manhinli closed 7 years ago
This affects the REST API as well.
http://stackoverflow.com/questions/10574218/creating-an-add-user-form-in-django problem:
user = super(RobogalsUserCreationForm, self).save(commit=False) # form checks is involved
vs
user = RobogalsUser.objects.create_user(**self.cleaned_data) # manager check is involved
what about using both:
user = super(RobogalsUserCreationForm, self).save(commit=False)
user = RobogalsUser.objects.create_user(**user.__dict__)
settings.py: where is
AUTH_USER_MODEL = 'myrg_users.models.RobogalsUser'
Could you fork and add your code as appropriate? Because I need to see how this fits in.
Approach 1:
clean_<field>() # add the individual field cleaner
Approach 2
clean() # over ride the original cleaner and add extra manager checks in addition to the original form checks
How to avoid the problem of: changing in multiple places?
As I said before, can you implement at least one to show how you would do it?
We have specific procedures when saving users which are not adhered to in admin forms because they use our custom form
myrg_users.forms.RobogalsUserCreationForm
.Attempt to use the existing user validation/correction method under
myrg_users.models.RobogalsUserManager