diff options
author | MR Lemon <matt@matthewlemon> | 2020-04-24 20:33:40 +0100 |
---|---|---|
committer | MR Lemon <matt@matthewlemon> | 2020-04-24 20:33:40 +0100 |
commit | deaa85227e47dd70301f88caca87edb0ad3f8adf (patch) | |
tree | de6ea5623df3ba6de94c2ddadf85ae8e5fc8f449 /ctrack/caf | |
parent | 301154e0a48ea2e2966afa92912317367dfcbe1b (diff) |
made create forms more consistent
Diffstat (limited to 'ctrack/caf')
-rw-r--r-- | ctrack/caf/forms.py | 14 | ||||
-rw-r--r-- | ctrack/caf/migrations/0003_auto_20200424_1924.py | 18 | ||||
-rw-r--r-- | ctrack/caf/models.py | 2 | ||||
-rw-r--r-- | ctrack/caf/templates/caf/applicable_system_create_from_caf.html | 21 | ||||
-rw-r--r-- | ctrack/caf/templates/caf/applicable_system_create_from_org.html | 22 | ||||
-rw-r--r-- | ctrack/caf/views.py | 3 |
6 files changed, 66 insertions, 14 deletions
diff --git a/ctrack/caf/forms.py b/ctrack/caf/forms.py index 3fe90a0..a21488a 100644 --- a/ctrack/caf/forms.py +++ b/ctrack/caf/forms.py @@ -34,9 +34,9 @@ class ApplicableSystemCreateFromCafForm(forms.Form): self.helper = FormHelper(self) self.helper.layout = Layout( Fieldset( - f"Create a new system for {caf}", - Field("name", css_class="form-control form-control-sm"), - Field("description", cass_class="form-control form-control-sm"), + "", + Field("name", css_class="form-control-lg"), + "description", Hidden("caf", caf_id), Hidden("organisation", org_id), ), @@ -61,11 +61,11 @@ class ApplicableSystemCreateFromOrgForm(forms.Form): self.helper = FormHelper(self) self.helper.layout = Layout( Fieldset( - f"Create a new system for {org_name}", - Field("name", css_class="form-control form-control-sm"), - Field("description", css_class="form-control form-control-sm"), + "", + Field("name", css_class="form-control-lg"), + "description", Hidden("organisation", org_id), - Field("caf", css_class="form-control form-control-sm") + "caf", ), ButtonHolder( Submit("submit", "Submit", css_class="btn-primary"), diff --git a/ctrack/caf/migrations/0003_auto_20200424_1924.py b/ctrack/caf/migrations/0003_auto_20200424_1924.py new file mode 100644 index 0000000..34613c6 --- /dev/null +++ b/ctrack/caf/migrations/0003_auto_20200424_1924.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.9 on 2020-04-24 19:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('caf', '0002_auto_20200403_1407'), + ] + + operations = [ + migrations.AlterField( + model_name='applicablesystem', + name='description', + field=models.TextField(blank=True, max_length=1000, null=True), + ), + ] diff --git a/ctrack/caf/models.py b/ctrack/caf/models.py index 0151d4b..1754e61 100644 --- a/ctrack/caf/models.py +++ b/ctrack/caf/models.py @@ -48,7 +48,7 @@ class ApplicableSystem(models.Model): return Organisation.objects.get_or_create(name="DELETED ORGANISATION")[0] name = models.CharField(max_length=256) - description = models.TextField(max_length=1000) + description = models.TextField(max_length=1000, blank=True, null=True) organisation = models.ForeignKey( Organisation, on_delete=models.SET(get_sentinel_org) ) diff --git a/ctrack/caf/templates/caf/applicable_system_create_from_caf.html b/ctrack/caf/templates/caf/applicable_system_create_from_caf.html index fffb5f4..0c39fb6 100644 --- a/ctrack/caf/templates/caf/applicable_system_create_from_caf.html +++ b/ctrack/caf/templates/caf/applicable_system_create_from_caf.html @@ -1,16 +1,31 @@ {% extends "base.html" %} + {% block title %} - Create a new Applicable System to an existing CAF + Add a new system to {{ caf }} {% endblock title %} {% load crispy_forms_tags %} {% block content %} - <div class="container"> + <div class="container mt-3"> <div class="row"> - <div class="col-sm-6"> + <div class="col-md-12 pl-0 my-2"> + <h4>Add a new system to {{ caf }}</h4> + </div> + </div> + <div class="row"> + <div class="col-md-7 pt-2 border bg-light"> {% crispy form %} </div> + <div class="col-sm-5"> + <div class="card" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">Help on System</h5> + <p class="card-text">Here you can add some supplementary text if you like.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> + </div> + </div> </div> </div> {% endblock content %} diff --git a/ctrack/caf/templates/caf/applicable_system_create_from_org.html b/ctrack/caf/templates/caf/applicable_system_create_from_org.html index a655f3e..0d0fcef 100644 --- a/ctrack/caf/templates/caf/applicable_system_create_from_org.html +++ b/ctrack/caf/templates/caf/applicable_system_create_from_org.html @@ -1,13 +1,31 @@ {% extends "base.html" %} +{% block title %} + Add a new system for {{ organisation }} +{% endblock title %} + {% load crispy_forms_tags %} {% block content %} - <div class="container"> + <div class="container mt-3"> <div class="row"> - <div class="col-sm-6"> + <div class="col-md-12 pl-0 my-2"> + <h4>Add a new system for {{ organisation }}</h4> + </div> + </div> + <div class="row"> + <div class="col-md-7 pt-2 border bg-light"> {% crispy form %} </div> + <div class="col-sm-5"> + <div class="card" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">Help on Adding a new System</h5> + <p class="card-text">Here you can add some supplementary text if you like.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> + </div> + </div> </div> </div> {% endblock content %} diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py index 5308421..0cee746 100644 --- a/ctrack/caf/views.py +++ b/ctrack/caf/views.py @@ -60,6 +60,7 @@ class ApplicableSystemDetail(LoginRequiredMixin, DetailView): @login_required def applicable_system_create_from_caf(request, caf_id): org_id = CAF.objects.get(pk=caf_id).organisation().id + caf = CAF.objects.get(id=caf_id) if request.method=="POST": form = ApplicableSystemCreateFromCafForm(request.POST, caf_id=caf_id, org_id=org_id) if form.is_valid(): @@ -73,7 +74,7 @@ def applicable_system_create_from_caf(request, caf_id): else: form = ApplicableSystemCreateFromCafForm(caf_id=caf_id, org_id=org_id) - return render(request, "caf/applicable_system_create_from_caf.html", {"form": form}) + return render(request, "caf/applicable_system_create_from_caf.html", {"form": form, "caf": caf}) class ApplicableSystemCreateFromOrg(LoginRequiredMixin, FormView): |