aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/register/views.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-20 09:37:24 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-20 09:37:45 +0100
commit025f217a973fc91a273afc3b5b5e6a62c5fa7328 (patch)
tree4bcbdd9619a55532650e5e208c2f40cb36d269bc /ctrack/register/views.py
parent990807fa2fcdea85c20e42359a00fbe0fa3a21d0 (diff)
added Note form - tests passing
Diffstat (limited to '')
-rw-r--r--ctrack/register/views.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/ctrack/register/views.py b/ctrack/register/views.py
index f8da4f1..935bbed 100644
--- a/ctrack/register/views.py
+++ b/ctrack/register/views.py
@@ -7,7 +7,7 @@ from ctrack.caf.models import CAF
from ctrack.organisations.models import Organisation
from ctrack.register.forms import (
CreateSimpleDateTimeEventForm,
- EngagementEventCreateForm,
+ EngagementEventCreateForm, CreateNoteEventForm,
)
from ctrack.register.models import EngagementEvent, SingleDateTimeEvent, NoteEvent
@@ -75,18 +75,15 @@ class EngagementEventCreateFromCaf(FormView):
class CreateNoteEvent(CreateView):
+ form_class = CreateNoteEventForm
model = NoteEvent
- fields = [
- "short_description",
- "organisation",
- "comments",
- "private",
- "url",
- "requested_response_date",
- "response_received_date",
- ]
template_name = "register/create_note_event_form.html"
+ def get_form_kwargs(self):
+ kwargs = super().get_form_kwargs()
+ kwargs["user"] = self.request.user
+ return kwargs
+
def form_valid(self, form):
note = form.save(commit=False)
note.user = self.request.user