#11685: Fix migration

This commit is contained in:
jeremystretch 2023-02-20 10:27:30 -05:00
parent 5a4d8a7107
commit 972ba7bfdc

View File

@ -10,8 +10,11 @@ def clear_cache(apps, schema_editor):
CachedValue = apps.get_model('extras', 'CachedValue')
for model_name in ('Aggregate', 'IPAddress', 'IPRange', 'Prefix'):
content_type = ContentType.objects.get(app_label='ipam', model=model_name.lower())
CachedValue.objects.filter(object_type=content_type).delete()
try:
content_type = ContentType.objects.get(app_label='ipam', model=model_name.lower())
CachedValue.objects.filter(object_type=content_type).delete()
except ContentType.DoesNotExist:
pass
class Migration(migrations.Migration):