-
Notifications
You must be signed in to change notification settings - Fork 42
fixing the migration to go with the rest of the 1.5 user model changes #6
base: auth-user-model-changes
Are you sure you want to change the base?
fixing the migration to go with the rest of the 1.5 user model changes #6
Conversation
Would the following also work?...
If so (?) it'd be cleaner, and using 'AUTH_USER_MODEL' is preferable to |
The get_user_model bit makes this work too though:
Maybe there's a cleaner way to solve that as well? |
Oh yikes. Yeah maybe what you have is best. Not super-comfortable with the whole crazy migration dance, but might be the only approach. Anyone seen an other projects dealing with this, and happy that this approach is sensible? |
My current approach is something i picked from other projects, i don't think there is a gold standard for this yet. would be nice if there was a 1.5 migration best practice somewhere. Maybe we should ask @pydanny? ;) |
Nothing so far. Come up with something, justify it nicely, and maybe it will become the standard. 💯 |
@tijs - I'd be happier with something like this... https://github.com/caffeinehit/django-oauth2-provider/pull/18/files Seems simpler / safer to me. Doesn't cover the case of using a custom db_table, but should deal with everything else. Thoughts? |
Aside: Hmmm. Seems we do the opposite in REST framework. https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/authtoken/migrations/0001_initial.py |
I have to leave for a bit but i'm pretty pragmatic about these things. Custom db_tales is perhaps not something a migration would have to cover although it's sort off nice that it does. Your call? |
@tomchristie searching through github code i'm getting a sense that the general concensus is a separate compat.py file containing:
Which you can then include where needed. In this case for the migrations but also in place of some of the other code in the rest of the compatibility code. Your version while a bit prettier seems to be in the minority amongst projects on github. Not that this is a democracy but lacking better arguments this seems to be something to go by perhaps? |
I would say that this at least fixes it for now so people downloading it will have a working version. The other use cases could then be looked at at a case by case basis perhaps?