From 59592232da815f4e8c6f61cb9042e738990c1b6e Mon Sep 17 00:00:00 2001
From: Matthew Lemon
Date: Fri, 16 Oct 2020 14:29:01 +0100
Subject: better handling of simple event form and participants
---
ctrack/register/forms.py | 4 +++-
ctrack/register/templates/single_datetime_event_create.html | 10 +++++++---
ctrack/register/tests/test_views.py | 9 ++++++++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/ctrack/register/forms.py b/ctrack/register/forms.py
index d658c9d..1549f75 100644
--- a/ctrack/register/forms.py
+++ b/ctrack/register/forms.py
@@ -39,7 +39,9 @@ class CreateSimpleDateTimeEventForm(forms.ModelForm):
if self.org_slug:
org = Organisation.objects.get(slug=self.org_slug)
self.fields["participants"].queryset = org.get_people()
- self.fields["participants"].help_text = f"Click to select participants from {org}"
+ self.fields["participants"].help_text = f"Click to select participants from {org}."
+ else:
+ self.fields["participants"].widget = forms.HiddenInput()
def clean(self):
cleaned_data = super().clean()
diff --git a/ctrack/register/templates/single_datetime_event_create.html b/ctrack/register/templates/single_datetime_event_create.html
index 6e607be..34ff22c 100644
--- a/ctrack/register/templates/single_datetime_event_create.html
+++ b/ctrack/register/templates/single_datetime_event_create.html
@@ -4,10 +4,14 @@
{% load crispy_forms_tags %}
{% block form %}
- Create a new simple event
+ {% if org %}
+ Create a new simple event involving {{ org }}
+ {% else %}
+ Create a new simple event
+ {% endif %}
Simple events are emails, phone calls, basic meetings, notes, deadlines, etc.
- If you arrived at this page from an organisation's page, you are able to select
- participants in the event from that organisation.
+ If you arrived at this page from an organisation's page, you are able to select
+ participants in the event from that organisation.