diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-24 16:50:16 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-24 16:50:16 +0100 |
commit | f845b310778e693cc85ca763bb1f9a6b892acbc4 (patch) | |
tree | 23e04a144e2c0affda1f4d9f79183580c9e71b59 /ctrack/organisations/views.py | |
parent | 57f241264d15aac3a015dd8a29c994c1ee691932 (diff) |
person contact history now filters out private events but the code needs refactoring badly
Diffstat (limited to 'ctrack/organisations/views.py')
-rw-r--r-- | ctrack/organisations/views.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py index 52d226a..51c8810 100644 --- a/ctrack/organisations/views.py +++ b/ctrack/organisations/views.py @@ -33,10 +33,20 @@ def person_contact_history(request, person_id): "-date" ) person = get_object_or_404(Person, id=person_id) + + _sdes = [ + filter_private_events( + person.get_single_datetime_events(), request.user + ) + ] + _all = list(itertools.chain.from_iterable(_sdes)) + _all = set(_all) + flat_sdes = sorted(_all, key=lambda e: e.date, reverse=True) + return render( request, "organisations/contact_history.html", - {"events": events, "person": person}, + {"events": flat_sdes, "person": person}, ) @@ -125,7 +135,6 @@ class OrganisationDetailView(PermissionRequiredMixin, DetailView): cafs = org.caf_set.all() # simple datetime events for org - # TODO - a note is not getting registered on org detail page after renamed datetime field so fix! notes = NoteEvent.objects.filter( user=self.request.user, organisation=self.object ).order_by("-created_date") |