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 that would work globally. > > I nearly have the monkey patch working however I'm getting the > following error, any idea? > > >>> from django.contrib.auth.models import UserManager > >>> a=UserManager() > >>> a.create_user(username='sdf', email='[EMAIL PROTECTED]', password='222') > > Traceback (most recent call last): > File "<console>", line 1, in <module> > File "/var/django/mysite/../mysite/hosting/models.py", line 166, in > my_create_user > return _create_user(self, username, email, password) > File "/usr/lib/python2.5/site-packages/django/contrib/auth/ > models.py", line 100, in create_user > user = self.model(None, username, '', '', email.strip().lower(), > 'placeholder', False, True, False, now, now) > TypeError: 'NoneType' object is not callable Your UserManager instance is not connected to any model, so it's model attribute is None. Manager classes are meant to be used thru model classes, not directly. IOW, you want: from django.contrib.auth.models import User user = User.objects.create_user(username='sdf', email='[EMAIL PROTECTED]', password='222') HTH --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" 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-users?hl=en -~----------~----~----~----~------~----~------~--~---

