Re: Problems with custom Auth Backends: 'NoneType' object has no attribute 'DoesNotExist'
The way to do what you're trying to do is to take advantage of the following: http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users In brief, you'll create another model, which will then be specified in your settings.py by AUTH_PROFILE_MODULE. From then on, you will be able to use the contrib.auth.model.User builtin function get_profile () to return your custom object. You will not be subclassing the User model; there's no need, and it greatly complicates things to try. I'm currently working on doing this myself, because I am adding requirements for the password change. Namely, I need the password to expire after 90 days, I need the initial password to require a reset after the first successful login, and I need to enforce some rules about the complexity and non-reuse of the password. Shawn --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problems with custom Auth Backends: 'NoneType' object has no attribute 'DoesNotExist'
The way to do what you're trying to do is to take advantage of the following: http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users In brief, you'll create another model, which will then be specified in your settings.py by AUTH_PROFILE_MODULE. From then on, you will be able to use the contrib.auth.model.User builtin function get_profile() to --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problems with custom Auth Backends: 'NoneType' object has no attribute 'DoesNotExist'
Hi, I want add a new attribute in User model and create custom backends. Steep by steep, I did the following: 1) I created an application named "profile" into my project 2) I created, in models.py of "profile" a class named "UserProfile", which inherits from User class of Django. I added "press_agency" attribute, and I wrote objects = UserManager() 3) I registered UserProfile and UserProfileAdmin classes in admin.py, and unregistered User of Django. 4) Into my project, I created auth_backends.py file. You should see it here: http://dpaste.com/hold/101036/ 5) In settings.py I wrote: AUTHENTICATION_BACKENDS = ( 'myproject.auth_backends.CustomUserModelBackend', ) CUSTOM_USER_MODEL = 'myproject.profile.UserProfile' Then, when I go to login, write mi name and password, y the system returns the following error: 'NoneType' object has no attribute 'DoesNotExist' Why? What is the problem? --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problems with custom Auth Backends: 'NoneType' object has no attribute 'DoesNotExist'
Hi, I want add a new attribute in User model and create custom backends. Steep by steep, I did the following: 1) I created an application named "profile" into my project 2) I created, in models.py of "profile" a class named "UserProfile", which inherits from User class of Django. I added "press_agency" attribute, and I wrote objects = UserManager() 3) I registered UserProfile and UserProfileAdmin classes in admin.py, and unregistered User of Django. 4) Into my project, I created auth_backends.py file. You should see it here: http://dpaste.com/hold/101036/ 5) In settings.py I wrote: AUTHENTICATION_BACKENDS = ( 'myproject.auth_backends.CustomUserModelBackend', ) CUSTOM_USER_MODEL = 'myproject.profile.UserProfile' Then, when I go to login, write mi name and password, y the system returns the following error: 'NoneType' object has no attribute 'DoesNotExist' Why? What is the problem? --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---