Django registration is not compatible with custom user models in Django 1.5, as it directly references django.contrib.auth.models.User in several places.
If you want to maintain your own copy you can swap those refs for those of your own User model. -scott Via mobile phone On Apr 16, 2013, at 9:59 PM, Rainy <andrei....@gmail.com> wrote: On Sunday, April 14, 2013 9:49:32 PM UTC-4, Lee Hinde wrote: > > I'm trying to do a 'simple' registration with just a user email and > password required to create an account. I'm using django-registration with > django 1.5.1 and have created a custom model and the custom model manager. > > I can hit all the registration forms just fine and have copied the example > from the django docs (ignoring, temporarily, the admonition not to do > that.). > > I've created a custom backend in django-registration, basically to remove > the username requirement. In fact, my custom backend is identical to the > default, minus any references to the username. > > When I try to create a new user (i.e, submit the form), from > /accounts/register/ I get the following error: > > AttributeError at /accounts/register/ > Manager isn't available; User has been swapped for 'letters.PCSUser' > > The full trace back is: > > File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in > get_response > 115. response = callback(request, > *callback_args, **callback_kwargs) > File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in > view > 68. return self.dispatch(request, *args, **kwargs) > File > "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py" > in dispatch > 79. return super(RegistrationView, self).dispatch(request, > *args, **kwargs) > File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in > dispatch > 86. return handler(request, *args, **kwargs) > File > "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py" > in post > 35. return self.form_valid(request, form) > File > "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py" > in form_valid > 82. new_user = self.register(request, **form.cleaned_data) > File > "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/backends/pcs/views.py" > in register > 80. > password, site) > File "/Library/Python/2.7/site-packages/django/db/transaction.py" in inner > 223. return func(*args, **kwargs) > File > "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/models.py" > in create_inactive_user > 78. new_user = User.objects.create_user( email, password) > File "/Library/Python/2.7/site-packages/django/db/models/manager.py" in > __get__ > 256. self.model._meta.object_name, self.model._meta.swapped > > > No doubt I've left out some needed component to show why this error is > coming up, but I'm not sure what. I'm grateful for any pointers on where I > should be looking. > > > I believe the issue is that you need to define usermanager on your custom user, and you will possibly need to inherit from django usermanager and override it to not use username anywhere. But at the very least, you need to do something like: import UserManager from wherever class CustomUser(User): objects = UserManager() -ak -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.