summaryrefslogtreecommitdiffstats
path: root/engagements/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'engagements/forms.py')
-rw-r--r--engagements/forms.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/engagements/forms.py b/engagements/forms.py
index 0fd44ea..852ba74 100644
--- a/engagements/forms.py
+++ b/engagements/forms.py
@@ -2,7 +2,7 @@ from django import forms
from django.core.exceptions import ValidationError
from django.forms.widgets import HiddenInput
-from .models import Engagement, EngagementEffort, EngagementStrategy
+from .models import Engagement, EngagementEffort, EngagementStrategy, EngagementType, Organisation
class EngagementEffortReportingCreateForm(forms.ModelForm):
@@ -242,3 +242,28 @@ class EngagementStrategyCreateForm(forms.ModelForm):
class Meta:
fields = "__all__"
model = EngagementStrategy
+
+
+class AssessmentCreateForm(forms.ModelForm):
+ class Meta:
+ model = Engagement
+ fields = ["proposed_start_date", "proposed_end_date", "officers", "engagement_type", "external_party"]
+
+ def __init__(self, *args, **kwargs):
+ # eng_type_id = kwargs.pop("eng_type_id", None)
+ # entity_id = kwargs.pop("entity_id", None)
+ super().__init__(*args, **kwargs)
+ self.fields["proposed_start_date"].initial = "tosser"
+ self.fields["engagement_type"].initial = "ASSESSMENT"
+ # if eng_type_id is not None:
+ # try:
+ # engagement_type = EngagementType.objects.get(id=eng_type_id)
+ # self.initial["engagement_type"] = engagement_type
+ # except EngagementType.DoesNotExist:
+ # raise ValidationError(f"EngagementType with id {eng_type_id} does not exist")
+ # if entity_id is not None:
+ # try:
+ # entity = Organisation.objects.get(id=entity_id)
+ # self.initial["external_party"] = entity
+ # except Organisation.DoesNotExist:
+ # raise ValidationError(f"Organisation with id {entity_id} does not exist")