diff options
-rw-r--r-- | feeds.py | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -102,16 +102,18 @@ class AtomFeed(Feed): return reverse("timetable", kwargs={"year_slug": group.timetable.year.slug, "timetable_slug": group.timetable.slug, "group_slug": group.slug, "year": item.year, "week": item.week}) def item_description(self, item): - template = loader.get_template("timetable.html") - context = {"group": item.group, "courses": item.courses, "last_update": item, "year": item.year, "week": item.week} - return template.render(context) + return item.description def items(self, obj): + template = loader.get_template("timetable.html") + group = obj[0] + for update in obj[1]: start, end = get_week(update.year, update.week) - courses = Course.objects.get_courses_for_group(obj[0], begin__gte=start, begin__lt=end) + courses = Course.objects.get_courses_for_group(group, begin__gte=start, begin__lt=end) + context = {"group": group, "courses": group_courses(courses), "last_update": update, "year": update.year, "week": update.week} - update.group = obj[0] - update.courses = group_courses(courses) + update.group = group + update.description = template.render(context) return obj[1] |