From: yomguy Date: Thu, 21 Feb 2013 17:18:28 +0000 (+0100) Subject: auto add seminars whrn auditor.conferences, filter 3 first steps for them X-Git-Tag: 2.8.1-pro~491^2~12 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=3cec82879400582aa5981a4c2be7e2de9994441e;p=teleforma.git auto add seminars whrn auditor.conferences, filter 3 first steps for them --- diff --git a/teleforma/models/pro.py b/teleforma/models/pro.py index 908bc312..0b4c7c78 100755 --- a/teleforma/models/pro.py +++ b/teleforma/models/pro.py @@ -264,6 +264,16 @@ class Auditor(models.Model): except: return '' + def clean(self): + seminars = self.seminars.all() + for conference in self.conferences.all(): + try: + seminar = conference.seminar.get() + if not seminar in seminars: + self.seminars.add(seminar) + except: + continue + class Meta(MetaCore): db_table = app_label + '_' + 'auditor' verbose_name = _('Auditor') diff --git a/teleforma/templates/teleforma/seminar_detail.html b/teleforma/templates/teleforma/seminar_detail.html index d476062d..ac5e2237 100644 --- a/teleforma/templates/teleforma/seminar_detail.html +++ b/teleforma/templates/teleforma/seminar_detail.html @@ -99,6 +99,8 @@ $(function () { {% endwith %} + {% if not seminar.conference in user.auditor.get.conferences.all %} + {% with seminar.question as questions %}
@@ -138,6 +140,8 @@ $(function () {
{% endif %} + {% endif %} + {% endblock course_content %}
diff --git a/teleforma/views/pro.py b/teleforma/views/pro.py index ab3bbc8c..16a14886 100644 --- a/teleforma/views/pro.py +++ b/teleforma/views/pro.py @@ -128,6 +128,7 @@ class SeminarView(SeminarAccessMixin, DetailView): context = super(SeminarView, self).get_context_data(**kwargs) seminar = context['seminar'] user = self.request.user + progress = seminar_progress(user, seminar) validated = seminar_validated(user, seminar) context['seminar_progress'] = progress