diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-23 14:30:48 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-23 14:30:48 +0100 |
commit | 070dd2999aba8a574fb2a2e9e23968e0d42e2490 (patch) | |
tree | a8743a788ac6b1fef18e0cc8601b33f387784fa9 | |
parent | e83a49075bf57c09579fc14b9e10637e17cd35f5 (diff) |
profile page is ok for now
-rw-r--r-- | ctrack/templates/users/user_detail.html | 14 | ||||
-rw-r--r-- | 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 @@ <th class="col-2">Date</th> <th class="col-2">Event</th> <th class="col-2">Organisation</th> - <th class="col-4">Comments</th> + <th class="col-3">Comments</th> + <th class="col-1">Actions</th> </tr> </thead> <tbody> @@ -98,8 +99,15 @@ </td> <td class="col-2">{{ event.date|date:"d M Y" }}</td> <td class="col-2">{{ event.short_description }}</td> - <td class="col-2">{{ event.organisation }}</td> - <td class="col-4">{{ event.comments }}</td> + <td class="col-2"> + {% if event.organisation %} + <a href="{% url "organisations:detail" event.organisation.slug %}">{{ event.organisation }}</a> + {% else %} + NA (DEBUG: THESE EVENTS HAVE TO PARTICIP.) + {% endif %} + </td> + <td class="col-3">{{ event.comments }}</td> + <td class="col-1"><a class="btn btn-sm btn-secondary" href="#" role="button">Edit</a></td> </tr> {% endfor %} </tbody> 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 |