Apply date from original collection to cloned exams in ExamCollectionClone
This commit is contained in:
@@ -4745,6 +4745,11 @@ class ExamCollectionClone(CreateView, AuthorRequiredMixin):
|
||||
if m2m_field in data:
|
||||
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
|
||||
# model_to_dict returns the FK id; replace with instance for create()
|
||||
data["examcollection"] = object
|
||||
|
||||
Reference in New Issue
Block a user