smoke test the rest of the apps
This commit is contained in:
+20
-15
@@ -971,26 +971,21 @@ class ExamOrCollectionGenericBase(models.Model, AuthorMixin):
|
||||
|
||||
|
||||
def clone_model(self):
|
||||
M2M_fields = (
|
||||
"exam_questions",
|
||||
"author",
|
||||
"valid_cid_users",
|
||||
"valid_user_users",
|
||||
"cid_user_groups",
|
||||
"user_user_groups",
|
||||
)
|
||||
m2m_fields = [f.name for f in self._meta.many_to_many]
|
||||
FK_fields = ("examcollection",)
|
||||
|
||||
model_dict = model_to_dict(self)
|
||||
|
||||
m2m_to_update = {}
|
||||
for field in M2M_fields:
|
||||
m2m_to_update[field] = model_dict[field]
|
||||
del model_dict[field]
|
||||
for field in m2m_fields:
|
||||
if field in model_dict:
|
||||
m2m_to_update[field] = model_dict[field]
|
||||
del model_dict[field]
|
||||
fk_to_update = {}
|
||||
for field in FK_fields:
|
||||
fk_to_update[field] = model_dict[field]
|
||||
del model_dict[field]
|
||||
if field in model_dict:
|
||||
fk_to_update[field] = model_dict[field]
|
||||
del model_dict[field]
|
||||
|
||||
cloned_model = self.__class__(**model_dict)
|
||||
cloned_model.pk = None
|
||||
@@ -2381,7 +2376,17 @@ class FindingBase(models.Model):
|
||||
return json.dumps(self.annotation_json)
|
||||
|
||||
def get_pretty_annotation_json(self):
|
||||
return get_pretty_json(json.loads(self.annotation_json))
|
||||
if not self.annotation_json:
|
||||
return ""
|
||||
try:
|
||||
return get_pretty_json(json.loads(self.annotation_json))
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
def get_pretty_viewport_json(self):
|
||||
return get_pretty_json(json.loads(self.viewport_json))
|
||||
if not self.viewport_json:
|
||||
return ""
|
||||
try:
|
||||
return get_pretty_json(json.loads(self.viewport_json))
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user