From 5e8475a02053f1df18d08d3c45afdf687b664fa4 Mon Sep 17 00:00:00 2001 From: MR Lemon Date: Fri, 17 Apr 2020 22:44:27 +0100 Subject: making the form slightly better --- ctrack/caf/forms.py | 13 +++++++------ ctrack/caf/views.py | 3 +++ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'ctrack/caf') diff --git a/ctrack/caf/forms.py b/ctrack/caf/forms.py index 5903a2c..1d07249 100644 --- a/ctrack/caf/forms.py +++ b/ctrack/caf/forms.py @@ -1,5 +1,5 @@ from crispy_forms.helper import FormHelper -from crispy_forms.layout import Button +from crispy_forms.layout import Button, Field from crispy_forms.layout import ButtonHolder from crispy_forms.layout import Fieldset from crispy_forms.layout import Layout @@ -28,13 +28,14 @@ class ApplicableSystemCreateForm(forms.ModelForm): self.helper.layout = Layout( Fieldset( "Create a new System", - "name", - "description", - "organisation", - "caf", + Field("name", css_class="form-control form-control-sm"), + Field("description", css_class="form-control form-control-sm"), + Field("organisation", css_class="form-control form-control-sm"), + Field("caf", css_class="form-control form-control-sm") ), ButtonHolder( - Submit("submit", "Submit", css_class="btn-primary") + Submit("submit", "Submit", css_class="btn-primary"), + Button("cancel", "Cancel", css_class="btn-danger") ) ) diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py index 9a5cb64..a0fc17b 100644 --- a/ctrack/caf/views.py +++ b/ctrack/caf/views.py @@ -1,5 +1,6 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render +from django.urls import reverse_lazy from django.views.generic import ListView, DetailView, CreateView from ctrack.assessments.models import CAFAssessmentOutcomeScore @@ -56,3 +57,5 @@ class ApplicableSystemCreate(LoginRequiredMixin, CreateView): form_class = ApplicableSystemCreateForm model = ApplicableSystem template_name = "caf/applicablesystem_create.html" + success_url = reverse_lazy("caf:es_list") + -- cgit v1.2.3