From 8ccf0fc77ac3e903b216e330862ff9f40a837c8d Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Mon, 16 Jan 2023 13:39:02 +0100 Subject: [PATCH] Undo : Add testimonial type field on seminar : https://trackers.pilotsystems.net/prebarreau/0606 --- .../0014_seminar_testimonial_type.py | 18 ++++++++++++++++++ teleforma/models/pro.py | 7 +++++++ teleforma/views/pro.py | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 teleforma/migrations/0014_seminar_testimonial_type.py diff --git a/teleforma/migrations/0014_seminar_testimonial_type.py b/teleforma/migrations/0014_seminar_testimonial_type.py new file mode 100644 index 00000000..22e79377 --- /dev/null +++ b/teleforma/migrations/0014_seminar_testimonial_type.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.3 on 2023-01-16 10:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('teleforma', '0013_seminarpart_index'), + ] + + operations = [ + migrations.AddField( + model_name='seminar', + name='testimonial_type', + field=models.CharField(blank=True, choices=[('elearning', 'E-learning'), ('blended', 'Blended')], max_length=10, null=True), + ), + ] diff --git a/teleforma/models/pro.py b/teleforma/models/pro.py index bc320555..860eff18 100644 --- a/teleforma/models/pro.py +++ b/teleforma/models/pro.py @@ -91,6 +91,13 @@ class Seminar(ClonableMixin, Displayable, ProductCodeMixin, SuggestionsMixin): duration = DurationField(_('approximative duration')) professor = models.ManyToManyField('Professor', related_name='seminar', verbose_name=_('professor'), blank=True) + class TestimonialType(models.TextChoices): + ELEARNING = 'elearning', "E-learning" + BLENDED = "blended", "Blended" + testimonial_type = models.CharField("Type d'attestation", + choices=TestimonialType.choices, + max_length=10, + null=True, blank=True) docs_description = models.ManyToManyField(Document, related_name="seminar_docs_description", verbose_name=_('description documents'), blank=True) diff --git a/teleforma/views/pro.py b/teleforma/views/pro.py index 1c47a530..2ed86496 100644 --- a/teleforma/views/pro.py +++ b/teleforma/views/pro.py @@ -832,7 +832,7 @@ class TestimonialView(PDFTemplateResponseMixin, SeminarView): context['testimonial'] = testimonials[0] context['blended'] = False - if seminar.conference: + if seminar.conference and seminar.testimonial_type != seminar.TESTIMONIAL_TYPE.ELEARNING.value: if seminar.conference.webclass and seminar.conference in self.request.user.auditor.get().conferences.all(): context['blended'] = True context['conference'] = seminar.conference -- 2.39.5