Apply date from original collection to cloned exams in ExamCollectionClone

This commit is contained in:
Ross
2025-11-06 21:41:53 +00:00
parent 2d963259ca
commit 04ce90049a
+5
View File
@@ -4745,6 +4745,11 @@ class ExamCollectionClone(CreateView, AuthorRequiredMixin):
if m2m_field in data: if m2m_field in data:
m2m_backup[m2m_field] = data.pop(m2m_field) m2m_backup[m2m_field] = data.pop(m2m_field)
# If the user supplied a date on the new collection, apply it to
# cloned exams so the cloned exams have the requested date.
if getattr(object, "date", None):
data["date"] = object.date
# Set the new examcollection foreign key to the newly created collection # Set the new examcollection foreign key to the newly created collection
# model_to_dict returns the FK id; replace with instance for create() # model_to_dict returns the FK id; replace with instance for create()
data["examcollection"] = object data["examcollection"] = object