Skip to content
This repository was archived by the owner on Dec 6, 2021. It is now read-only.

Auth user model changes#5

Open
AngryLawyer wants to merge 7 commits intomasterfrom
auth-user-model-changes
Open

Auth user model changes#5
AngryLawyer wants to merge 7 commits intomasterfrom
auth-user-model-changes

Conversation

@AngryLawyer
Copy link
Copy Markdown

Now supports custom User models in Django 1.5 and above.

@tijs
Copy link
Copy Markdown

tijs commented Jul 9, 2013

Looks good to go! I'd love for this to be merged so i can use the 'official' version in my project instead of a fork... @tomchristie

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would make sense to use getattr(settings, 'AUTH_USER_MODEL', 'auth.User') here instead of the branching.

@tijs
Copy link
Copy Markdown

tijs commented Jul 9, 2013

It might still need a quick;

python manage.py schemamigration userroles --update --initial

as the migrations are not updated yet to reflect the other changes...

@j4mie
Copy link
Copy Markdown
Member

j4mie commented Jul 10, 2013

We need to do some thinking about the migrations. Is it actually possible to support all of the following cases?

  • Project running Django<1.5 upgrades to new version of django-user-roles (nothing should change)
  • Project running Django>=1.5 without custom user model upgrades to new version of django-user-roles (nothing should change)
  • Project running Django>=1.5 with custom user model that wasn't previously using django-user-roles installs new version of django-user-roles (userroles_userrole table should be created with a foreign key to the custom user model)
  • Project running Django<1.5 that was previously using django-user-roles upgrades to new version of django-user-roles and at the same time changes to a custom user model (what the hell should happen here?)

This StackOverflow question might be useful: http://stackoverflow.com/questions/15472704/trouble-migrating-reusable-django-app-models-to-use-a-custom-user-model

Perhaps we should leave complex cases to the user - just document using the SOUTH_MIGRATION_MODULES setting to add a custom location for migrations for django-user-roles that point at your custom user model?

@tijs
Copy link
Copy Markdown

tijs commented Jul 10, 2013

i think you can only go so far in supporting all of these. if you've already run the migration nothing will happen if you upgrade django-user-roles which is probably what you want anyway. if your moving to a custom user model it's your own responsibility to make a data migration that makes sense i would think...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants