Fix migration error which happens on first migrate, when dynamic-preferences models aren't yet created.

This commit is contained in:
Tiberiu Chibici 2020-10-18 15:54:03 +03:00
parent 5175846310
commit 363852973b

View File

@ -5,7 +5,12 @@ import json
def fix_video_provider(apps, schema_editor): def fix_video_provider(apps, schema_editor):
try:
globalPrefs = apps.get_model('dynamic_preferences', 'GlobalPreferenceModel') globalPrefs = apps.get_model('dynamic_preferences', 'GlobalPreferenceModel')
except LookupError as e:
print("Warning: could not get dynamic_preferences model.")
return
api_key_entries = globalPrefs.objects.filter(name='youtube_api_key') api_key_entries = globalPrefs.objects.filter(name='youtube_api_key')
if len(api_key_entries) < 1: if len(api_key_entries) < 1:
return return