From: Guillaume Pellerin Date: Wed, 30 Sep 2020 10:27:38 +0000 (+0200) Subject: seminar copy: add exception for bisextile year X-Git-Tag: 2.8.1-pro~183^2~1 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e2053915bcff16c8c07009754b05a63f63d5990f;p=teleforma.git seminar copy: add exception for bisextile year --- diff --git a/teleforma/management/commands/teleforma-copy-seminars.py b/teleforma/management/commands/teleforma-copy-seminars.py index d0b3940f..3fed3de6 100644 --- a/teleforma/management/commands/teleforma-copy-seminars.py +++ b/teleforma/management/commands/teleforma-copy-seminars.py @@ -51,7 +51,12 @@ class Command(BaseCommand): if seminar.period == from_period and not seminar.code in self.less: clone = seminar.clone() clone.publish_date = seminar.publish_date.replace(year=to_year) - clone.expiry_date = seminar.expiry_date.replace(year=to_year) + print(seminar.expiry_date) + if seminar.expiry_date.month == 2 and seminar.expiry_date.day == 29: + clone.expiry_date = seminar.expiry_date.replace(day=28) + clone.expiry_date = clone.expiry_date.replace(year=to_year) + else: + clone.expiry_date = seminar.expiry_date.replace(year=to_year) clone.date_forced = datetime.datetime(to_year, 1, 1) clone.period = to_period clone.status = 1