don't delete settings that are marked as read_only

This commit is contained in:
Ryan Petrello
2017-08-04 10:06:35 -04:00
parent 8fd7a94c62
commit b4d69cb5c7
2 changed files with 29 additions and 0 deletions

View File

@@ -148,6 +148,8 @@ class SettingSingletonDetail(RetrieveUpdateDestroyAPIView):
def perform_destroy(self, instance):
settings_change_list = []
for setting in self.get_queryset().exclude(key='LICENSE'):
if settings_registry.get_setting_field(setting.key).read_only:
continue
setting.delete()
settings_change_list.append(setting.key)
if settings_change_list and 'migrate_to_database_settings' not in sys.argv: