aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/register/forms.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-08 15:46:28 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-08 15:46:28 +0100
commit238c656bc30c2da12bcdaac70a5e0453b97e4dfb (patch)
tree234ac14bd43f51095cdb3433d0041e9697b89c0d /ctrack/register/forms.py
parentb5c3a9468ffff07b09067b7d06fdcafaec2d23cf (diff)
selects the first person in list when presenting the form
Diffstat (limited to 'ctrack/register/forms.py')
-rw-r--r--ctrack/register/forms.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/ctrack/register/forms.py b/ctrack/register/forms.py
index 2fc5ff1..3f13d33 100644
--- a/ctrack/register/forms.py
+++ b/ctrack/register/forms.py
@@ -45,7 +45,9 @@ class EngagementEventCreateForm(forms.ModelForm):
else:
org = get_object_or_404(Organisation, slug=org_slug)
cancel_redirect = reverse("organisations:detail", args=[org_slug])
- self.fields["participants"].queryset = Person.objects.filter(organisation__slug=org_slug)
+ selectable_people = Person.objects.filter(organisation__slug=org_slug)
+ self.fields["participants"].queryset = selectable_people
+ self.fields["participants"].initial = selectable_people.first()
self.fields["type"].queryset = EngagementType.objects.all().order_by("descriptor")
self.fields["related_caf"].queryset = org.caf_set.all()
self.fields["related_caf"].label = "Related CAFs"