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/templates/users/user_detail.html | 14 +++++++++++--- ctrack/users/views.py | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ctrack/templates/users/user_detail.html b/ctrack/templates/users/user_detail.html index e991a25..376410b 100644 --- a/ctrack/templates/users/user_detail.html +++ b/ctrack/templates/users/user_detail.html @@ -84,7 +84,8 @@ Date Event Organisation - Comments + Comments + Actions @@ -98,8 +99,15 @@ {{ event.date|date:"d M Y" }} {{ event.short_description }} - {{ event.organisation }} - {{ event.comments }} + + {% if event.organisation %} + {{ event.organisation }} + {% else %} + NA (DEBUG: THESE EVENTS HAVE TO PARTICIP.) + {% endif %} + + {{ event.comments }} + Edit {% endfor %} 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