I did not notice you were trying to override in a wrong way, sorry
about that.
Actually for override the user model you need to:
class CustomUser(User):
#your new fields, DRY user fields
objects = MyCustomManager()
class MyCustomManager(models.Manager):
def create_mycustom_user(...
On Nov 28, 8:02 am, bruno desthuilliers
<[EMAIL PROTECTED]> wrote:
> On 28 nov, 09:45, Paddy Joy <[EMAIL PROTECTED]> wrote:
>
> > Thanks however I'm guessing:
>
> > > admin.site.unregister(User)
> > > admin.site.register(User, NewModelForm)
>
> > will only work in the admin site?
>
> Yes.
Actua
On 28 nov, 09:45, Paddy Joy <[EMAIL PROTECTED]> wrote:
> Thanks however I'm guessing:
>
>
>
> > admin.site.unregister(User)
> > admin.site.register(User, NewModelForm)
>
> will only work in the admin site?
Yes.
> Not actually using the admin site at
> the moment but would nice to have something
Thanks however I'm guessing:
>
> admin.site.unregister(User)
> admin.site.register(User, NewModelForm)
>
will only work in the admin site? Not actually using the admin site at
the moment but would nice to have something that would work globally.
I nearly have the monkey patch working however I'
Maybe you could override the save method in a New User Model Form:
save_model(self, request, obj, form, change)
So you can:
admin.site.unregister(User)
admin.site.register(User, NewModelForm)
http://docs.djangoproject.com/en/dev/ref/contrib/admin/
I hope this could help you!
And finally the
On 27 nov, 17:11, Paddy Joy <[EMAIL PROTECTED]> wrote:
> 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,
On even further inspection, you may in fact want to
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 <[EM
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, crea
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 creat
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.mode
10 matches
Mail list logo