From f125be2549e5f4f04c8097b7305be2982ccff063 Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Wed, 22 Nov 2017 17:39:44 -0500 Subject: Change Drivers to vendors in some locations. Remove description field for uploads, changed to filename. Still need to update template. --- app/dispatch/forms.py | 2 +- .../migrations/0005_remove_paperwork_description.py | 19 +++++++++++++++++++ app/dispatch/migrations/0006_paperwork_filename.py | 20 ++++++++++++++++++++ .../migrations/0007_remove_paperwork_filename.py | 19 +++++++++++++++++++ app/dispatch/models.py | 6 ++++-- app/dispatch/templates/dispatch/drivers/list.html | 4 ++-- .../templates/dispatch/generic_load_listing.html | 2 +- app/dispatch/templates/dispatch/loads/detail.html | 2 +- app/dispatch/templates/dispatch/loads/list.html | 2 +- app/dispatch/templates/dispatch/nav.html | 2 +- app/dispatch/templates/dispatch/paperwork/add.html | 18 ++++++++++++++---- 11 files changed, 83 insertions(+), 13 deletions(-) create mode 100644 app/dispatch/migrations/0005_remove_paperwork_description.py create mode 100644 app/dispatch/migrations/0006_paperwork_filename.py create mode 100644 app/dispatch/migrations/0007_remove_paperwork_filename.py (limited to 'app/dispatch') diff --git a/app/dispatch/forms.py b/app/dispatch/forms.py index feeda39..fc3f4f0 100644 --- a/app/dispatch/forms.py +++ b/app/dispatch/forms.py @@ -6,7 +6,7 @@ from dispatch.models import Paperwork class AddPaperworkForm(forms.ModelForm): class Meta: model = Paperwork - fields = ('description', 'document') + fields = ['document'] class InviteForm(forms.Form): first_name = forms.CharField(label="User's name") diff --git a/app/dispatch/migrations/0005_remove_paperwork_description.py b/app/dispatch/migrations/0005_remove_paperwork_description.py new file mode 100644 index 0000000..5c65a43 --- /dev/null +++ b/app/dispatch/migrations/0005_remove_paperwork_description.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-11-22 21:41 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('dispatch', '0004_auto_20171110_1400'), + ] + + operations = [ + migrations.RemoveField( + model_name='paperwork', + name='description', + ), + ] diff --git a/app/dispatch/migrations/0006_paperwork_filename.py b/app/dispatch/migrations/0006_paperwork_filename.py new file mode 100644 index 0000000..dab77ae --- /dev/null +++ b/app/dispatch/migrations/0006_paperwork_filename.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-11-22 22:09 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dispatch', '0005_remove_paperwork_description'), + ] + + operations = [ + migrations.AddField( + model_name='paperwork', + name='filename', + field=models.CharField(default='', max_length=256), + ), + ] diff --git a/app/dispatch/migrations/0007_remove_paperwork_filename.py b/app/dispatch/migrations/0007_remove_paperwork_filename.py new file mode 100644 index 0000000..156d2cd --- /dev/null +++ b/app/dispatch/migrations/0007_remove_paperwork_filename.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-11-22 22:15 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('dispatch', '0006_paperwork_filename'), + ] + + operations = [ + migrations.RemoveField( + model_name='paperwork', + name='filename', + ), + ] diff --git a/app/dispatch/models.py b/app/dispatch/models.py index 5801828..58d47fb 100644 --- a/app/dispatch/models.py +++ b/app/dispatch/models.py @@ -7,6 +7,7 @@ from datetime import datetime from django.core.exceptions import ObjectDoesNotExist from .misc import get_week_dates, paperwork_user_directory_path from django.core.urlresolvers import reverse +import re # Create your models here. @@ -50,11 +51,12 @@ class Load(models.Model): class Paperwork(models.Model): load = models.ForeignKey(Load, on_delete=models.CASCADE) - description = models.CharField(max_length=256) document = models.FileField(upload_to=paperwork_user_directory_path) def __str__(self): - return "%s" % self.load + # It's a terrible fucking hack, but it works + return re.sub('paperwork\/\d+\/[a-zA-z0-9]+-', '', str(self.document)) + # return "%s" % self.load class Identity(models.Model): diff --git a/app/dispatch/templates/dispatch/drivers/list.html b/app/dispatch/templates/dispatch/drivers/list.html index f1e5be6..a5db74a 100644 --- a/app/dispatch/templates/dispatch/drivers/list.html +++ b/app/dispatch/templates/dispatch/drivers/list.html @@ -1,11 +1,11 @@ {% extends 'dispatch/base.html' %} -{% block title %}Drivers{% endblock %} +{% block title %}Vendors and Users{% endblock %} {% block content %}
-

Drivers

+

Vendors and Users

diff --git a/app/dispatch/templates/dispatch/generic_load_listing.html b/app/dispatch/templates/dispatch/generic_load_listing.html index 3a78335..60ed1d2 100644 --- a/app/dispatch/templates/dispatch/generic_load_listing.html +++ b/app/dispatch/templates/dispatch/generic_load_listing.html @@ -42,7 +42,7 @@ {{ load.customer.name }} {% endif %} {% endif %} - {% if "Driver" in load_headers %} + {% if "Driver" in load_headers or "Vendor" in load_headers or "Vendor/Driver" in load_headers %} {{ load.user.first_name }} {{ load.user.last_name }} {% endif %} diff --git a/app/dispatch/templates/dispatch/loads/detail.html b/app/dispatch/templates/dispatch/loads/detail.html index 288fdd8..6cdbae0 100644 --- a/app/dispatch/templates/dispatch/loads/detail.html +++ b/app/dispatch/templates/dispatch/loads/detail.html @@ -88,7 +88,7 @@ {% for p in paperwork_list %} - {{p.description}} + {{p}}
Delete diff --git a/app/dispatch/templates/dispatch/loads/list.html b/app/dispatch/templates/dispatch/loads/list.html index 615c4e1..e615432 100644 --- a/app/dispatch/templates/dispatch/loads/list.html +++ b/app/dispatch/templates/dispatch/loads/list.html @@ -24,7 +24,7 @@ {% load custom_tags %} -{% listForCommaString "Customer,Driver,Amount,Description,Attachments" as load_headers %} +{% listForCommaString "Customer,Vendor,Amount,Description,Attachments" as load_headers %} {% include "dispatch/generic_load_listing.html" %}
diff --git a/app/dispatch/templates/dispatch/nav.html b/app/dispatch/templates/dispatch/nav.html index ef65d24..bc34d41 100644 --- a/app/dispatch/templates/dispatch/nav.html +++ b/app/dispatch/templates/dispatch/nav.html @@ -6,7 +6,7 @@
  • Loads
  • Invoices
  • {% if request.user.is_superuser %} -
  • Drivers
  • +
  • Vendors
  • Customers
  • {% else %}
  • Summary diff --git a/app/dispatch/templates/dispatch/paperwork/add.html b/app/dispatch/templates/dispatch/paperwork/add.html index f828f9c..d5ec623 100644 --- a/app/dispatch/templates/dispatch/paperwork/add.html +++ b/app/dispatch/templates/dispatch/paperwork/add.html @@ -1,24 +1,34 @@ {% extends 'dispatch/base.html' %} -{% block title %}Edit - {{ object.description }}{% endblock %} +{% block title %}Upload File{% endblock %} {% block content %}
    -

    {{object.name}}

    +

    Upload Files

    +
    +
    + {% if form.errors %} {{form.errors}} {% endif %} +
    +
    +

    Click the "Choose File" button to upload the appropriate file from your + computer. ( Usually a Bill of Lading )

    +
    +
    + {% csrf_token %} {{ form.as_p }} -
    - +
    +
  • {% endblock %} -- cgit v1.2.3