Thanks a lot for the answers guys. I´m still trying to wrap my head
around it though. The last thing for me to get is at what point is the
class variable/attribute model declared and when it gets assigned, I
sort of assumed what it was doing but really did not get how, I took a
look at the "base"  and "model" classes but things are still a little
hazy


Thanks

On Feb 17, 9:47 am, "Joseph Kocherhans" <[EMAIL PROTECTED]> wrote:
> 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