diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-18 14:50:00 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-18 14:50:00 +0100 |
commit | fed4b3157f25f65ccdaa5fd41463995a080d4673 (patch) | |
tree | 9ad2cea4a1076663f18ed27e738da979dfe7e128 /ctrack/register/forms.py | |
parent | bc10c9df7b9d3678e4efd9d05055f41ccd8a763f (diff) |
nice links from org detail page to specific types of simple event
Diffstat (limited to 'ctrack/register/forms.py')
-rw-r--r-- | ctrack/register/forms.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ctrack/register/forms.py b/ctrack/register/forms.py index 1549f75..b061ec3 100644 --- a/ctrack/register/forms.py +++ b/ctrack/register/forms.py @@ -35,11 +35,14 @@ class CreateSimpleDateTimeEventForm(forms.ModelForm): def __init__(self, *args, **kwargs): self.user = kwargs.pop("user") self.org_slug = kwargs.pop("org_slug") + self.event_type = kwargs.pop("event_type") super().__init__(*args, **kwargs) 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}." + if self.event_type: + self.fields["type_descriptor"].initial = self.event_type else: self.fields["participants"].widget = forms.HiddenInput() |