Thanks for the tips, signals would work except I need access to the
raw password when users are created.

On further inspection it seems I would need to override the
UserManager, I know I can extend it with more methods but I don't
think I can override it.

Paddy

On Nov 27, 12:39 am, sergioh <[EMAIL PROTECTED]> wrote:
> Signals are the better way to achieve. You usually override the save
> method when you need to define something related with the model
> itself, but in many cases signals are the better way to notify some
> function to do something if a model change (after save)
>
> def your_function(sender, instance, created=False, **kwargs):
>       # your tasks
>
> models.signals.post_save.connect(your_function, sender=User)  #this
> relate your User model with the signal
>
> regards,
>
> Sergio Hinojosa
>
> On Nov 26, 7:01 am, "Alex Koshelev" <[EMAIL PROTECTED]> wrote:
>
> > Of course you can monkey-patch the User model but the better way is to use
> > signals pre_ or post_save
>
> > On Wed, Nov 26, 2008 at 13:54, Paddy Joy <[EMAIL PROTECTED]> wrote:
>
> > > I would like to override the save() method on the contrib.auth User
> > > model so that I can run a routine when a user is created/modified.
>
> > > Is this possible or do I need to use a signal? I have tried overriding
> > > the User model like this but it never seems to call my code:
>
> > > from django.contrib.auth.models import User
>
> > > # Override User model
> > > class User(models.Model):
>
> > >        def save(self):
>
> > >                # Do something here
> > >                myroutine()
> > >                super(User, self).save()
>
> > > Can anyone help?
>
> > > Paddy
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to