From 070dd2999aba8a574fb2a2e9e23968e0d42e2490 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Fri, 23 Oct 2020 14:30:48 +0100 Subject: profile page is ok for now --- ctrack/users/views.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ctrack/users/views.py') diff --git a/ctrack/users/views.py b/ctrack/users/views.py index 693318b..8924ea8 100644 --- a/ctrack/users/views.py +++ b/ctrack/users/views.py @@ -40,6 +40,12 @@ class UserDetailView(DetailView): _caf_twin_date_events = CAFTwinDateEvent.objects.all() _combined = list(itertools.chain(_caf_twin_date_events, _caf_single_date_events, _single_date_events)) all_events = sorted(_combined, key=self._comp_dates, reverse=True) + for event in all_events: + try: + org = event.participants.first().organisation + setattr(event, "organisation", org) + except AttributeError: + setattr(event, "organisation", None) context["all_events"] = all_events context["lead_oes"] = lead_oes return context -- cgit v1.2.3