From da1014421d0fffa146a6ee581a9c522c84b8c1fe Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 2 Nov 2016 21:24:52 +0200 Subject: Cleanup --- servo/management/commands/obfuscate.py | 66 ++++++++++++++--------------- servo/migrations/0061_auto_20161102_1212.py | 20 +++++++++ servo/templates/orders/devices.html | 8 ++-- servo/templates/orders/tabs.html | 2 +- servo/urls/order.py | 2 +- servo/urls/repairs.py | 14 +++--- servo/views/checkin.py | 6 +-- servo/views/gsx.py | 8 ++-- 8 files changed, 71 insertions(+), 55 deletions(-) create mode 100644 servo/migrations/0061_auto_20161102_1212.py (limited to 'servo') diff --git a/servo/management/commands/obfuscate.py b/servo/management/commands/obfuscate.py index bd0b5c7..09e8639 100644 --- a/servo/management/commands/obfuscate.py +++ b/servo/management/commands/obfuscate.py @@ -12,39 +12,38 @@ class Command(BaseCommand): def handle(self, *args, **options): help = "Obfuscates the information in this Servo install" names = ('Daniel Scott', 'Amy Collins', 'Linda Moore', - 'Dennis Parker', 'Mark Cox', 'Jesse Clark', - 'Brian Patterson', 'Andrew Bennett', 'Frank Lopez', - 'Benjamin Wood', 'Michelle Jenkins', 'Alice Lee', - 'Lois Gonzales', 'Diane Perez', 'Cheryl Torres', - 'Ernest Smith', 'Steve Mitchell', 'Barbara Jones', - 'Wanda Roberts', 'Julie Watson', 'Carlos Harris', - 'Anthony Phillips', 'Ralph Gray', 'Donna Hill', - 'Alan Coleman', 'Lawrence Ross', 'Stephen Flores', - 'Robert Simmons', 'Gloria White', 'Doris Wilson', - 'Shirley Sanders', 'Matthew Bell', 'Janice Hughes', - 'Walter Nelson', 'Gerald Taylor', 'Tammy Martin', - 'Gregory Barnes', 'Jonathan Baker', 'Lillian Green', - 'Brenda Hernandez', 'Denise Davis', 'Bobby Rogers', - 'Joe Lewis', 'Teresa Bailey', 'Craig Russell', - 'Angela Rivera', 'Rebecca Jackson', 'Nicole Henderson', - 'Kenneth James', 'Nicholas Bryant', 'Anne Washington', - 'Irene Miller', 'Theresa Martinez', 'Evelyn Sanchez', - 'Richard Anderson', 'Jeffrey Robinson', 'Heather Diaz', - 'Joshua Butler', 'Joan Peterson', 'Todd Campbell', - 'Timothy Kelly', 'Steven King', 'Norma Reed', - 'Carolyn Turner', 'Ruth Evans', 'Carol Thomas', - 'Arthur Howard', 'Peter Carter', 'Debra Ramirez', - 'Marie Walker', 'Donald Garcia', 'Janet Gonzalez', - 'Harold Adams', 'Bonnie Cook', 'Paula Long', - 'Bruce Griffin', 'Adam Hall' ,'Annie Young', - 'Jacqueline Alexander', 'Kimberly Edwards', 'Sarah Wright', - 'Terry Williams', 'Johnny Morris', 'Andrea Ward', - 'Margaret Allen', 'Sandra Price', 'Scott Foster', - 'Elizabeth Brown', 'Wayne Cooper', 'Mildred Brooks', - 'Dorothy Perry', 'Lori Powell', 'Kathryn Murphy', - 'Judy Johnson', 'Albert Morgan', 'William Richardson', - 'Randy Stewart', 'Roger Thompson', 'Anna Rodriguez', - ) + 'Dennis Parker', 'Mark Cox', 'Jesse Clark', + 'Brian Patterson', 'Andrew Bennett', 'Frank Lopez', + 'Benjamin Wood', 'Michelle Jenkins', 'Alice Lee', + 'Lois Gonzales', 'Diane Perez', 'Cheryl Torres', + 'Ernest Smith', 'Steve Mitchell', 'Barbara Jones', + 'Wanda Roberts', 'Julie Watson', 'Carlos Harris', + 'Anthony Phillips', 'Ralph Gray', 'Donna Hill', + 'Alan Coleman', 'Lawrence Ross', 'Stephen Flores', + 'Robert Simmons', 'Gloria White', 'Doris Wilson', + 'Shirley Sanders', 'Matthew Bell', 'Janice Hughes', + 'Walter Nelson', 'Gerald Taylor', 'Tammy Martin', + 'Gregory Barnes', 'Jonathan Baker', 'Lillian Green', + 'Brenda Hernandez', 'Denise Davis', 'Bobby Rogers', + 'Joe Lewis', 'Teresa Bailey', 'Craig Russell', + 'Angela Rivera', 'Rebecca Jackson', 'Nicole Henderson', + 'Kenneth James', 'Nicholas Bryant', 'Anne Washington', + 'Irene Miller', 'Theresa Martinez', 'Evelyn Sanchez', + 'Richard Anderson', 'Jeffrey Robinson', 'Heather Diaz', + 'Joshua Butler', 'Joan Peterson', 'Todd Campbell', + 'Timothy Kelly', 'Steven King', 'Norma Reed', + 'Carolyn Turner', 'Ruth Evans', 'Carol Thomas', + 'Arthur Howard', 'Peter Carter', 'Debra Ramirez', + 'Marie Walker', 'Donald Garcia', 'Janet Gonzalez', + 'Harold Adams', 'Bonnie Cook', 'Paula Long', + 'Bruce Griffin', 'Adam Hall', 'Annie Young', + 'Jacqueline Alexander', 'Kimberly Edwards', 'Sarah Wright', + 'Terry Williams', 'Johnny Morris', 'Andrea Ward', + 'Margaret Allen', 'Sandra Price', 'Scott Foster', + 'Elizabeth Brown', 'Wayne Cooper', 'Mildred Brooks', + 'Dorothy Perry', 'Lori Powell', 'Kathryn Murphy', + 'Judy Johnson', 'Albert Morgan', 'William Richardson', + 'Randy Stewart', 'Roger Thompson', 'Anna Rodriguez',) """ print 'Munging customer names of open orders...' for i in Order.objects.filter(state=Order.STATE_QUEUED): @@ -80,4 +79,3 @@ class Command(BaseCommand): i.title = 'GSX Account %s' % chr(a) a += 1 i.save() - diff --git a/servo/migrations/0061_auto_20161102_1212.py b/servo/migrations/0061_auto_20161102_1212.py new file mode 100644 index 0000000..c8d50ff --- /dev/null +++ b/servo/migrations/0061_auto_20161102_1212.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.2 on 2016-11-02 10:12 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('servo', '0060_auto_20161101_1215'), + ] + + operations = [ + migrations.AlterField( + model_name='location', + name='notes', + field=models.TextField(blank=True, default='Business hours between 9:00 - 18:00', help_text='Will be shown on print templates', verbose_name='Notes'), + ), + ] diff --git a/servo/templates/orders/devices.html b/servo/templates/orders/devices.html index 002906f..792b570 100755 --- a/servo/templates/orders/devices.html +++ b/servo/templates/orders/devices.html @@ -77,12 +77,12 @@ diff --git a/servo/templates/orders/tabs.html b/servo/templates/orders/tabs.html index 134aa9f..44d71c6 100755 --- a/servo/templates/orders/tabs.html +++ b/servo/templates/orders/tabs.html @@ -3,6 +3,6 @@ {% trans "Order" %} {% for r in order.repair_set.all %} -{{ r.get_number }} + {{ r.get_number }} {% endfor %} {% trans "Events" %} diff --git a/servo/urls/order.py b/servo/urls/order.py index 8d17056..92df96f 100644 --- a/servo/urls/order.py +++ b/servo/urls/order.py @@ -4,7 +4,7 @@ from servo.views import note from django.conf.urls import url from servo.views.order import * from servo.views.invoices import create_invoice -from servo.views.gsx import create_repair, edit_repair, import_repair, delete_repair +from servo.views.gsx import create_repair, edit_repair, import_repair urlpatterns = [ diff --git a/servo/urls/repairs.py b/servo/urls/repairs.py index e87991b..e6f3819 100644 --- a/servo/urls/repairs.py +++ b/servo/urls/repairs.py @@ -2,14 +2,14 @@ from django.conf.urls import url -from servo.views.gsx import * +from servo.views import gsx urlpatterns = [ - url(r'^(\d+)/delete/$', delete_repair, name="repairs-delete_repair"), - url(r'^(\d+)/parts/(\d+)/remove/$', remove_part, name="repairs-remove_part"), - url(r'^(\d+)/parts/(\d+)/add/$', add_part, name="repairs-add_part"), - url(r'^(\d+)/parts/(\d+)/update_sn/$', update_sn, name="repairs-update_sn"), - url(r'^(\d+)/copy/$', copy_repair, name="repairs-copy_repair"), - url(r'^(\d+)/check_parts/$', check_parts_warranty, name="repairs-check_parts"), + url(r'^(\d+)/delete/$', gsx.delete_repair, name="repairs-delete_repair"), + url(r'^(\d+)/parts/(\d+)/remove/$', gsx.remove_part, name="repairs-remove_part"), + url(r'^(\d+)/parts/(\d+)/add/$', gsx.add_part, name="repairs-add_part"), + url(r'^(\d+)/parts/(\d+)/update_sn/$', gsx.update_sn, name="repairs-update_sn"), + url(r'^(\d+)/copy/$', gsx.copy_repair, name="repairs-copy_repair"), + url(r'^(\d+)/check_parts/$', gsx.check_parts_warranty, name="repairs-check_parts"), ] diff --git a/servo/views/checkin.py b/servo/views/checkin.py index 9d89544..1b8f96e 100644 --- a/servo/views/checkin.py +++ b/servo/views/checkin.py @@ -148,14 +148,14 @@ def init_session(request): except KeyError: # not given - default to session, then auth user user_id = request.session.get('checkin_user', user.pk) - + user = get_object_or_404(User, pk=user_id) request.session['checkin_locations'] = Location.get_checkin_list() checkin_users = User.get_checkin_group() queryset = checkin_users.filter(location=location) request.session['checkin_users'] = User.serialize(queryset) - + request.session['checkin_user'] = user.pk request.session['checkin_location'] = location.pk request.session['checkin_user_name'] = user.get_name() @@ -176,7 +176,7 @@ def thanks(request, order): try: request.session.delete_test_cookie() except KeyError: - pass # ignore spurious KeyError at /checkin/thanks/RJTPS/ + pass # ignore spurious KeyError at /checkin/thanks/RJTPS/ try: order = Order.objects.get(url_code=order) diff --git a/servo/views/gsx.py b/servo/views/gsx.py index 12be6c9..2f0f057 100644 --- a/servo/views/gsx.py +++ b/servo/views/gsx.py @@ -133,11 +133,9 @@ def remove_part(request, repair, part): return render(request, "repairs/delete_part.html", data) -def delete_repair(request, repair_id): - """ - Deletes this unsubmitted GSX repair - """ - repair = get_object_or_404(Repair, pk=repair_id) +def delete_repair(request, pk): + """Delete this unsubmitted GSX repair.""" + repair = get_object_or_404(Repair, pk=pk) if repair.is_submitted(): messages.error(request, _('Submitted repairs cannot be deleted')) -- cgit v1.2.3