django-user-roles icon indicating copy to clipboard operation
django-user-roles copied to clipboard

Auth user model changes

Open AngryLawyer opened this issue 12 years ago • 4 comments

Now supports custom User models in Django 1.5 and above.

AngryLawyer avatar May 28 '13 15:05 AngryLawyer

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

tijs avatar Jul 09 '13 08:07 tijs

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...

tijs avatar Jul 09 '13 08:07 tijs

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?

j4mie avatar Jul 10 '13 13:07 j4mie

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...

tijs avatar Jul 10 '13 13:07 tijs