From: yomguy Date: Mon, 11 Feb 2013 13:44:18 +0000 (+0100) Subject: add demo seminars if no other seminar available (the course.title should be 'demo') X-Git-Tag: 0.9-probarreau~72 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=20c606d0a2961afc301662f37a8cc26b020bf02c;p=teleforma.git add demo seminars if no other seminar available (the course.title should be 'demo') --- diff --git a/teleforma/context_processors.py b/teleforma/context_processors.py index ec08417c..9b337485 100644 --- a/teleforma/context_processors.py +++ b/teleforma/context_processors.py @@ -124,6 +124,11 @@ def all_seminars(request, progress_order=False, date_order=False): seminars = sorted(s_list, key=lambda k: k['date'], reverse=True) seminars = [s['seminar'] for s in seminars] + # get the demo if no seminars + if not seminars: + course = Course.objects.get(title='demo') + seminars = Seminar.objects.filter(course=course) + return {'all_seminars': seminars}