aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/register/forms.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-12 12:26:39 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-12 12:26:39 +0100
commit3f818f99669ab0b49f98b7e7da43c38dc119bfd5 (patch)
tree972a6603c46581495e5946bf6a1995eac9ddf4b7 /ctrack/register/forms.py
parent7db4392801aca82d1dec6eb57abf7cb74c10689c (diff)
another test added for CAFTwinDateEventForm
Diffstat (limited to '')
-rw-r--r--ctrack/register/forms.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/ctrack/register/forms.py b/ctrack/register/forms.py
index b09804e..1d46c36 100644
--- a/ctrack/register/forms.py
+++ b/ctrack/register/forms.py
@@ -11,6 +11,7 @@ from ctrack.register.models import (
EngagementType,
CAFSingleDateEvent,
SingleDateTimeEvent,
+ CAFTwinDateEvent,
)
@@ -58,6 +59,29 @@ class CAFSingleDateEventForm(forms.ModelForm):
return form
+class CAFTwinDateEventForm(forms.ModelForm):
+ class Meta:
+ model = CAFTwinDateEvent
+ fields = [
+ "type_descriptor",
+ "related_caf",
+ "short_description",
+ "start_date",
+ "end_date",
+ "comments",
+ ]
+
+ def __init__(self, *args, **kwargs):
+ self.user = kwargs.pop("user")
+ super().__init__(*args, **kwargs)
+
+ def save(self, **kwargs):
+ form = super().save(commit=False)
+ form.user = self.user
+ form.save()
+ return form
+
+
class EngagementEventCreateForm(forms.ModelForm):
def __init__(self, user, caf=None, org_slug=None, *args, **kwargs):
super().__init__(*args, **kwargs)