From 04ce90049ada0b8ed365ff0b68942e2395e293f3 Mon Sep 17 00:00:00 2001 From: Ross Date: Thu, 6 Nov 2025 21:41:53 +0000 Subject: [PATCH] Apply date from original collection to cloned exams in ExamCollectionClone --- generic/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/generic/views.py b/generic/views.py index 2411fd36..027ab42c 100644 --- a/generic/views.py +++ b/generic/views.py @@ -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