From 36556dea332225316f175d2387a10ab789295344 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Tue, 17 Mar 2020 20:07:14 +0000 Subject: [PATCH] Add the usual set of fields to supplier and update form accordingly --- RIGS/templates/index.html | 4 ++ RIGS/templates/rigboard.html | 2 +- assets/migrations/0011_auto_20200317_2006.py | 33 +++++++++++++ assets/models.py | 5 ++ assets/templates/asset_list.html | 6 +-- .../partials/asset_list_table_body.html | 6 +-- assets/templates/supplier_update.html | 48 +++++++++++++++++-- .../partials/generic_list.html | 0 .../partials/last_edited.html | 0 9 files changed, 92 insertions(+), 12 deletions(-) create mode 100644 assets/migrations/0011_auto_20200317_2006.py rename {RIGS/templates => templates}/partials/generic_list.html (100%) rename {RIGS/templates => templates}/partials/last_edited.html (100%) diff --git a/RIGS/templates/index.html b/RIGS/templates/index.html index 200dbd40..5480a5cf 100644 --- a/RIGS/templates/index.html +++ b/RIGS/templates/index.html @@ -25,6 +25,10 @@ {% if perms.assets.add_asset %} New Asset {% endif %} + Supplier List + {% if perms.assets.add_asset %} + New Supplier + {% endif %}

Quick Links

diff --git a/RIGS/templates/rigboard.html b/RIGS/templates/rigboard.html index 9f91fe98..7cc31478 100644 --- a/RIGS/templates/rigboard.html +++ b/RIGS/templates/rigboard.html @@ -6,7 +6,7 @@

Rigboard

{% if perms.RIGS.add_event %} - New + New {% endif %}
{% include 'event_table.html' %} diff --git a/assets/migrations/0011_auto_20200317_2006.py b/assets/migrations/0011_auto_20200317_2006.py new file mode 100644 index 00000000..94ec2154 --- /dev/null +++ b/assets/migrations/0011_auto_20200317_2006.py @@ -0,0 +1,33 @@ +# Generated by Django 3.0.3 on 2020-03-17 20:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('assets', '0010_auto_20200219_1444'), + ] + + operations = [ + migrations.AddField( + model_name='supplier', + name='address', + field=models.TextField(blank=True, null=True), + ), + migrations.AddField( + model_name='supplier', + name='email', + field=models.EmailField(blank=True, max_length=254, null=True), + ), + migrations.AddField( + model_name='supplier', + name='notes', + field=models.TextField(blank=True, null=True), + ), + migrations.AddField( + model_name='supplier', + name='phone', + field=models.CharField(blank=True, max_length=15, null=True), + ), + ] diff --git a/assets/models.py b/assets/models.py index a6c767f1..4853695d 100644 --- a/assets/models.py +++ b/assets/models.py @@ -45,6 +45,11 @@ class Supplier(models.Model, RevisionMixin): ordering = ['name'] name = models.CharField(max_length=80) + phone = models.CharField(max_length=15, blank=True, null=True) + email = models.EmailField(blank=True, null=True) + address = models.TextField(blank=True, null=True) + + notes = models.TextField(blank=True, null=True) def get_absolute_url(self): return reverse('supplier_list') diff --git a/assets/templates/asset_list.html b/assets/templates/asset_list.html index 6c04b56d..7bcefd45 100644 --- a/assets/templates/asset_list.html +++ b/assets/templates/asset_list.html @@ -20,14 +20,14 @@
-
+
{% render_field form.query|add_class:'form-control' placeholder='Search by Asset ID/Desc/Serial' style="width: 250px"%}
-
+
{% render_field form.category|attr:'multiple'|add_class:'form-control custom-select selectpicker' data-none-selected-text="Categories" data-header="Categories" data-actions-box="true" %} @@ -41,7 +41,7 @@
-New +New diff --git a/assets/templates/partials/asset_list_table_body.html b/assets/templates/partials/asset_list_table_body.html index f0f382b5..4de27ff7 100644 --- a/assets/templates/partials/asset_list_table_body.html +++ b/assets/templates/partials/asset_list_table_body.html @@ -6,10 +6,10 @@ diff --git a/assets/templates/supplier_update.html b/assets/templates/supplier_update.html index af50c0eb..739dbbac 100644 --- a/assets/templates/supplier_update.html +++ b/assets/templates/supplier_update.html @@ -1,8 +1,9 @@ {% extends 'base_assets.html' %} -{% block title %}Edit{% endblock %} +{% load widget_tweaks %} + +{% block title %}Edit Supplier{% endblock %} {% block content %} - - + {% csrf_token %} {% include 'form_errors.html' %} - {{ form }} - +
+ +
+ {% render_field form.name|add_class:'form-control' value=object.name %} +
+
+
+ +
+ {% render_field form.phone class+="form-control" type="tel" placeholder=form.phone.label %} +
+
+
+ +
+ {% render_field form.email class+="form-control" type="email" placeholder=form.email.label %} +
+
+
+ + +
+ {% render_field form.address class+="form-control" placeholder=form.address.label %} +
+
+
+ + +
+ {% render_field form.notes class+="form-control" placeholder=form.notes.label %} +
+
+
+ +
{% endblock %} diff --git a/RIGS/templates/partials/generic_list.html b/templates/partials/generic_list.html similarity index 100% rename from RIGS/templates/partials/generic_list.html rename to templates/partials/generic_list.html diff --git a/RIGS/templates/partials/last_edited.html b/templates/partials/last_edited.html similarity index 100% rename from RIGS/templates/partials/last_edited.html rename to templates/partials/last_edited.html
{{ item.status }}