Hi,
I'd like to thank you for this app and your support. Much appreciated.
I'm running into some lazy reference issues when I try to swap the application model on django 1.10. I believe I've followed the steps outlined in https://django-oauth-toolkit.readthedocs.io/en/latest/advanced_topics.html. I'm running into some migration issues when I try to create a migration to add the new model. Here's the output:
(env-brownpapersession)bastb@bastb-vps:/var/www/brownpapersession/dev/brownpapersession$ python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/django/core/management/base.py", line 305, in run_from_argv
self.execute(*args, **cmd_options)
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/django/core/management/base.py", line 356, in execute
output = self.handle(*args, **options)
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py", line 167, in handle
migration_name=self.migration_name,
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 47, in changes
changes = self._detect_changes(convert_apps, graph)
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 132, in _detect_changes
self.old_apps = self.from_state.concrete_apps
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 180, in concrete_apps
self.apps = StateApps(self.real_apps, self.models, ignore_swappable=True)
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 249, in __init__
raise ValueError("\n".join(error.msg for error in errors))
ValueError: The field oauth2_provider.AccessToken.application was declared with a lazy reference to 'app.brownpaperapplication', but app 'app' doesn't provide model 'brownpaperapplication'.
The field oauth2_provider.Grant.application was declared with a lazy reference to 'app.brownpaperapplication', but app 'app' doesn't provide model 'brownpaperapplication'.
The field oauth2_provider.RefreshToken.application was declared with a lazy reference to 'app.brownpaperapplication', but app 'app' doesn't provide model 'brownpaperapplication'.
I've changed the setting and added the model
OAUTH2_PROVIDER_APPLICATION_MODEL = 'app.BrownPaperApplication'
Can you help me?
I found the solution while writing this PR but decided to go ahead filing the PR anyway.
The solution was actually quite simple. First add the swapping model and create and run the migration. Then change the setting to swap the model.
I followed the steps specified here and in the google groups forums: https://groups.google.com/forum/#!msg/django-oauth-toolkit/a5qTWOctc2A/5X6zapo-NgAJ
I manage to create the vendor but I get a Related modelapp.MyApp` cannot be resolved. Has anyone encountered this issue too?
Fixed by #407
Most helpful comment
I found the solution while writing this PR but decided to go ahead filing the PR anyway.
The solution was actually quite simple. First add the swapping model and create and run the migration. Then change the setting to swap the model.