Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't support Django 1.5 custom authenication #145

Closed
nemith opened this issue Apr 15, 2013 · 11 comments
Closed

Doesn't support Django 1.5 custom authenication #145

nemith opened this issue Apr 15, 2013 · 11 comments

Comments

@nemith
Copy link

nemith commented Apr 15, 2013

With Django 1.5 we have the option to specify a customer User model to use for Django authentication.

Need to update / check for Django 1.5 and use settings.AUTH_USER_MODEL in place of auth.User

(inetpro)homestar:inetpro_project bbennett$ python manage.py syncdb
CommandError: One or more models did not validate:
wiki.article: 'owner' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
wiki.articlerevision: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
wiki.revisionpluginrevision: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
wiki.attachmentrevision: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
django_notify.settings: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
@benjaoming
Copy link
Member

Sounds like the right thing to do, just keeping in mind that older Django versions do not have settings.AUTH_USER_MODEL so perhaps maintain the reference in wiki.conf.settings where hasattr(django_settings, 'AUTH_USER_MODEL') can be put.

@nemith
Copy link
Author

nemith commented Apr 16, 2013

That would work. I have tested it putting it just in the model's module but having issues with South migrations that still point to auth.User

@benjaoming
Copy link
Member

Oh right, that's not ideal.

See also this response:

http://stackoverflow.com/questions/15472704/trouble-migrating-reusable-django-app-models-to-use-a-custom-user-model

You could alter all the migrations to use get_user_model() but it's not going to help someone changing their user model. However, it seems like to most fit solution. Consequence is just (but I think this is pointed out in the Django docs).. Do not think you can go about changing your user model afterwards :)

@wenzhixue
Copy link

can we have a fix for this? everybody is using django 1.5 now.... it's keep the new people from using it

@benjaoming
Copy link
Member

@wenzhixue there are no known issues with Django 1.5, except that you cannot use settings.AUTH_USER_MODEL atm.

benjaoming added a commit that referenced this issue May 18, 2013
…oreignKey fields and South migrations. Backwards-compatible.
@benjaoming
Copy link
Member

@nemith and @wenzhixue could you guys test this commit in your scenarios? Please note that changing AUTH_USER_MODEL in an existing project is highly discouraged. The best way to go is to have it set before the first syncdb and migrate.

@benjaoming
Copy link
Member

Please watch the following bug on Django to see if account handling will be made possible for custom user models:

https://code.djangoproject.com/ticket/20086

If they do not allow custom user models in django.contrib.auth.forms UserCreateForm and UserChangeForm, then I'm afraid it will not be possible to support.

@benjaoming
Copy link
Member

I'm closing this as I don't really think you guys are testing it, and since the upstream ticket for UserCreateForm and UserChangeForm has been closed as a wont-fix.

@nemith
Copy link
Author

nemith commented Jul 16, 2013

My project got put on hold, so I haven't been able to test. I take it that it is assumed to work now?

@benjaoming
Copy link
Member

Yes, it's almost working, but account handling does not work, i.e. the sign up page is broken, but I take it most projects have their own if they're also doing custom user models :)

@benjaoming
Copy link
Member

I'll amend that a bit: It works just fine, but the pre-shipped sign up function which is absolutely non-essential for someone using a custom user model, does not work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants