On 2/17/07, voltron <[EMAIL PROTECTED]> wrote:
>
> class UserManager(models.Manager):
>     def create_user(self, username, email, password):
>         "Creates and saves a User with the given username, e-mail and
> password."
>         now = datetime.datetime.now()
>         user = self.model(None, username, '', '',
> email.strip().lower(), 'placeholder', False, True, False, now, now)
>     ...
> ...
> #SNIP
>
> I do not understand this line:
> user = self.model(None, username, '', '', email.strip().lower(),
> 'placeholder', False, True, False, now, now)
>
> I looked in the class definition of  Manager and I found no
> model.__init__ function that would take the arguments listed above, I
> dug deeper and looked at the definition of "Model", no luck.

A custom manager can access the model it is bound to via self.model.
It is referring to django.contrib.auth.model.User in this case. The
line you are pointing out is just calling the User model's
constructor.

http://www.djangoproject.com/documentation/model_api/#custom-managers

Joseph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to