diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-19 21:00:49 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-19 21:00:49 +0100 |
commit | 990807fa2fcdea85c20e42359a00fbe0fa3a21d0 (patch) | |
tree | ac492733270ffe6c32fc2b64eda9b46ea41a8e36 /ctrack/register/views.py | |
parent | c07178fb19f55ea8354b2de153a2d41c66d58f32 (diff) |
can now add a note to the system for an organisation but not listed on detail page yet
Diffstat (limited to '')
-rw-r--r-- | ctrack/register/views.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/ctrack/register/views.py b/ctrack/register/views.py index d2dca72..f8da4f1 100644 --- a/ctrack/register/views.py +++ b/ctrack/register/views.py @@ -1,8 +1,7 @@ from django.contrib.auth import get_user_model -from django.contrib.auth.mixins import LoginRequiredMixin from django.http import HttpResponseRedirect from django.urls import reverse_lazy -from django.views.generic import DeleteView, FormView, UpdateView +from django.views.generic import DeleteView, FormView, UpdateView, CreateView from ctrack.caf.models import CAF from ctrack.organisations.models import Organisation @@ -10,7 +9,7 @@ from ctrack.register.forms import ( CreateSimpleDateTimeEventForm, EngagementEventCreateForm, ) -from ctrack.register.models import EngagementEvent, SingleDateTimeEvent +from ctrack.register.models import EngagementEvent, SingleDateTimeEvent, NoteEvent class EngagementEventDelete(DeleteView): @@ -75,6 +74,29 @@ class EngagementEventCreateFromCaf(FormView): return reverse_lazy("organisations:detail", args=[org_slug]) +class CreateNoteEvent(CreateView): + model = NoteEvent + fields = [ + "short_description", + "organisation", + "comments", + "private", + "url", + "requested_response_date", + "response_received_date", + ] + template_name = "register/create_note_event_form.html" + + def form_valid(self, form): + note = form.save(commit=False) + note.user = self.request.user + note.save() + return super().form_valid(form) + + def get_success_url(self): + return reverse_lazy("organisations:detail", args=[self.object.organisation.slug]) + + class SingleDateTimeEventUpdate(UpdateView): model = SingleDateTimeEvent fields = [ |