From 7ef05e8d639b22a123ee14d52420eb345f4ea768 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 19 Dec 2013 18:43:08 +0100 Subject: [PATCH] fix name --- teleforma/management/commands/teleforma-copy-seminars.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/teleforma/management/commands/teleforma-copy-seminars.py b/teleforma/management/commands/teleforma-copy-seminars.py index 8781260b..68802868 100644 --- a/teleforma/management/commands/teleforma-copy-seminars.py +++ b/teleforma/management/commands/teleforma-copy-seminars.py @@ -31,8 +31,8 @@ class Command(BaseCommand): if seminar.expiry_date.year == from_year: print ("cloning:", seminar) clone = seminar.clone() - clone.publish_date = clone.publish_date.replace(year=to_year) - clone.expiry_date = clone.expiry_date.replace(year=to_year) + clone.publish_date = seminar.publish_date.replace(year=to_year) + clone.expiry_date = seminar.expiry_date.replace(year=to_year) clone.save() print ('dates updated', clone) @@ -40,7 +40,6 @@ class Command(BaseCommand): if field.rel.to == Document or field.rel.to == Media: source = getattr(seminar, field.attname) destination = getattr(clone, field.attname) - print source, destination for item in source.all(): print item @@ -54,8 +53,7 @@ class Command(BaseCommand): destination.add(item_clone) print ("cloned and assigned:", item_clone) - questions = seminar.question.all() - for question in questions: + for question in seminar.question.all(): question_clone = question.clone() question_clone.seminar = clone question.save() -- 2.39.5