'step': '5'
}
]
- if seminar.conference and seminar.conference.webclass and seminar.conference in user.auditor.get().conferences.all():
+
+ if seminar.use_webclass(user):
objects[1]['obj'] = seminar.conference
for item in objects:
def suggestions(self):
return (list(self.suggested_seminars.all())+list(self.suggested_conferences.all()))[:3]
+ def use_webclass(self, user):
+ """
+ Should we show the webclass or the media ?
+ If the user subscribe to the conference, then show the webclass
+ If the user subscribe to the seminar and there are no medias, then show the webclass, else show the media.
+ """
+ return self.conference and self.conference.webclass and (self.conference in user.auditor.get().conferences.all() or not self.medias.count())
+
def clone_to_next_year(self):
""" copy the seminar for next year """
log = ""
</div>
{% endwith %}
- {% if seminar.conference.webclass and seminar.conference in user.auditor.get.conferences.all %}
+ {% if show_webclass %}
{% with seminar.conference as webclass %}
<div class="course_content">
<div class="course_subtitle">
context = super(SeminarView, self).get_context_data(**kwargs)
seminar = context['seminar']
user = self.request.user
-
+ context['show_webclass'] = seminar.use_webclass(user)
validated = seminar_validated(user, seminar)
if validated:
# check if testimonial exists and create it