Read it. 

Understand it now. Thanks!

On Tuesday, February 3, 2015 at 10:12:08 PM UTC+8, Daniel Roseman wrote:
>
>
> On Tuesday, 3 February 2015 06:19:47 UTC, Max Nathaniel Ho wrote:
>>
>> Hi all,
>>
>> I am following this tutorial (
>> http://musings.tinbrain.net/blog/2014/sep/21/registration-django-easy-way/) 
>> to create a user registration model in Django.
>>
>> I understand that the class UserManager is overwriting the default User 
>> model. However, I do not understand this particular part.
>>
>> The official Django Documentation doesn't explain what this means - It 
>> merely shows the full code.
>>
>> https://docs.djangoproject.com/en/1.7/topics/auth/customizing/
>>
>> Need some clarification as to what's going on here. What is self.model in 
>> this example and what does it do?
>>
>>     def create_user(self, email, password, **kwargs):
>>         user = self.model(email=self.normalize_email(email), 
>> is_active=True, **kwargs)
>>         user.set_password(password)
>>         user.save(using=self._db)
>>         return user
>>
>>
>
> It is not doing any such thing as "overwriting the default User model". 
> That is a Manager: your first port of call should have been the 
> documentation for model managers, which is here:
> https://docs.djangoproject.com/en/1.7/topics/db/managers/
>
> If there's anything you don't understand after having read that, please 
> come back and ask a more specific question.
> --
> DR.
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/f10f4717-e9fd-4080-99f5-b268a1eccbf9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to