diff options
| author | Mitch Riedstra <Mitch@riedstra.us> | 2017-11-22 17:39:44 -0500 |
|---|---|---|
| committer | Mitch Riedstra <Mitch@riedstra.us> | 2017-11-22 17:39:44 -0500 |
| commit | f125be2549e5f4f04c8097b7305be2982ccff063 (patch) | |
| tree | 0f408132547f9151707555e4718e7981b5b8f2e8 | |
| parent | 63e7134298288514473e86614b51daa40b37cdd7 (diff) | |
| download | dispatch-tracker-f125be2549e5f4f04c8097b7305be2982ccff063.tar.gz dispatch-tracker-f125be2549e5f4f04c8097b7305be2982ccff063.tar.xz | |
Change Drivers to vendors in some locations. Remove description field for uploads, changed to filename. Still need to update template.
| -rw-r--r-- | app/dispatch/forms.py | 2 | ||||
| -rw-r--r-- | app/dispatch/migrations/0005_remove_paperwork_description.py | 19 | ||||
| -rw-r--r-- | app/dispatch/migrations/0006_paperwork_filename.py | 20 | ||||
| -rw-r--r-- | app/dispatch/migrations/0007_remove_paperwork_filename.py | 19 | ||||
| -rw-r--r-- | app/dispatch/models.py | 6 | ||||
| -rw-r--r-- | app/dispatch/templates/dispatch/drivers/list.html | 4 | ||||
| -rw-r--r-- | app/dispatch/templates/dispatch/generic_load_listing.html | 2 | ||||
| -rw-r--r-- | app/dispatch/templates/dispatch/loads/detail.html | 2 | ||||
| -rw-r--r-- | app/dispatch/templates/dispatch/loads/list.html | 2 | ||||
| -rw-r--r-- | app/dispatch/templates/dispatch/nav.html | 2 | ||||
| -rw-r--r-- | app/dispatch/templates/dispatch/paperwork/add.html | 18 | ||||
| -rw-r--r-- | app/dispatchAuth/models.py | 7 |
12 files changed, 89 insertions, 14 deletions
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 %} <div class="row"> <div class="col s12 m6"> - <h1>Drivers</h1> + <h1>Vendors and Users</h1> </div> </div> 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 @@ <td>{{ load.customer.name }}</td> {% endif %} {% endif %} - {% if "Driver" in load_headers %} + {% if "Driver" in load_headers or "Vendor" in load_headers or "Vendor/Driver" in load_headers %} <td><a href="{% url 'driver_summary' load.user.id %}">{{ load.user.first_name }} {{ load.user.last_name }}</a></td> {% 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 @@ <tbody> {% for p in paperwork_list %} <tr> - <td>{{p.description}}</td> + <td>{{p}}</td> <td class="right-align"> <form action="{% url 'paperwork_delete' object.id p.id %}" id="attach_delete_{{p.pk}}" method="GET"> <a class="btn red" href="#" onClick="warn_submit('Are you sure?', '#attach_delete_{{p.pk}}')">Delete</a> 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 @@ </div> {% 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" %} <div class="row"> 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 @@ <li><a href="{% url 'load_list' %}">Loads</a></li> <li><a href="{% url 'invoice_list' %}">Invoices</a></li> {% if request.user.is_superuser %} - <li><a href="{% url 'driver_list' %}">Drivers</a></li> + <li><a href="{% url 'driver_list' %}">Vendors</a></li> <li><a href="{% url 'customer_list' %}">Customers</a></li> {% else %} <li><a href="{% url 'driver_summary' request.user.id %}">Summary</a> 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 %} <div class="row"> <div class="col s12 m6"> - <h1>{{object.name}}</h1> + <h1>Upload Files</h1> </div> </div> +<div class="divider" ></div> +<div style="padding-bottom: 50px;"></div> + {% if form.errors %} {{form.errors}} {% endif %} +<div class="row"> + <div class="col s12"> + <p>Click the "Choose File" button to upload the appropriate file from your + computer. ( Usually a Bill of Lading )</p> + </div> +</div> + <form action="" method="post" enctype="multipart/form-data">{% csrf_token %} {{ form.as_p }} - <div style="padding-top: 10px;"></div> - <input type="submit" class="btn blue" value="Update" /> + <div style="padding-top: 30px;"></div> + <input type="submit" class="btn blue" value="Upload" /> </form> {% endblock %} diff --git a/app/dispatchAuth/models.py b/app/dispatchAuth/models.py index a1c4b55..fe720fd 100644 --- a/app/dispatchAuth/models.py +++ b/app/dispatchAuth/models.py @@ -67,7 +67,12 @@ class User(PermissionsMixin, AbstractBaseUser): return reverse('driver_details', kwargs={'pk': self.pk}) def __str__(self): - return self.email + # return self.email + # Show the Identity associated with the user, not the user itself + try: + return "{} ({} {})".format(self.identity, self.first_name, self.last_name) + except: + return "{} {} ({})".format(self.first_name, self.last_name, self.email) def email_user(self, subject, message, from_email=None, **kwargs): """Send an email to this user.""" |
