aboutsummaryrefslogtreecommitdiffstats
path: root/servo
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-11-07 18:43:43 +0200
committerFilipp Lepalaan <filipp@mac.com>2016-11-07 18:43:43 +0200
commit7dbcacd01bec20db3ccb841bec1e8e4268a4b052 (patch)
treeefb19d27b0420ce734e895a48fd5622f77dcc634 /servo
parentc087462f4deec9650da7b965ef8ecfb2fece07f3 (diff)
downloadServo-7dbcacd01bec20db3ccb841bec1e8e4268a4b052.tar.gz
Servo-7dbcacd01bec20db3ccb841bec1e8e4268a4b052.tar.bz2
Servo-7dbcacd01bec20db3ccb841bec1e8e4268a4b052.zip
Fixed spurious keyword error
list_orders() got an unexpected keyword argument 'queue'
Diffstat (limited to 'servo')
-rw-r--r--servo/models/queue.py10
-rw-r--r--servo/tests/test_models.py7
-rw-r--r--servo/urls/order.py69
3 files changed, 60 insertions, 26 deletions
diff --git a/servo/models/queue.py b/servo/models/queue.py
index eb8414e..7650f46 100644
--- a/servo/models/queue.py
+++ b/servo/models/queue.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from datetime import timedelta
-from django.conf import settings
from django.db import models
from django.utils import timezone
@@ -160,7 +159,8 @@ class Queue(models.Model):
return reverse('admin-edit_queue', args=[self.pk])
def get_absolute_url(self):
- return reverse('orders-list_queue', args=[self.pk])
+ p = '?queue=%d' % self.pk
+ return reverse('orders-index') + p
def get_order_count(self, max_state=2):
count = self.order_set.filter(state__lt=max_state).count()
@@ -260,10 +260,12 @@ class QueueStatus(models.Model):
"""
Gets the green time limit for this QS
"""
- return timezone.now() + timedelta(seconds=self.limit_green*self.limit_factor)
+ sec = self.limit_green * self.limit_factor
+ return timezone.now() + timedelta(seconds=sec)
def get_yellow_limit(self):
- return timezone.now() + timedelta(seconds=self.limit_yellow*self.limit_factor)
+ sec = self.limit_yellow * self.limit_factor
+ return timezone.now() + timedelta(seconds=sec)
def __unicode__(self):
return self.status.title
diff --git a/servo/tests/test_models.py b/servo/tests/test_models.py
index 263834a..b0ef6e7 100644
--- a/servo/tests/test_models.py
+++ b/servo/tests/test_models.py
@@ -6,6 +6,7 @@ from django.test import TestCase
from servo.models.common import Configuration
from servo.models.order import Order
from servo.models.account import User
+from servo.models.queue import Queue
class ConfigurationTests(TestCase):
@@ -25,5 +26,11 @@ class ServiceOrderTests(TestCase):
self.assertEquals(o.location, o.checkin_location)
+class QueueTests(TestCase):
+ def test_absolute_url(self):
+ q = Queue.objects.get(pk=1)
+ self.assertRegexpMatches(q.get_absolute_url(), r'\?queue=\d$')
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/servo/urls/order.py b/servo/urls/order.py
index 92df96f..c22cdac 100644
--- a/servo/urls/order.py
+++ b/servo/urls/order.py
@@ -9,7 +9,6 @@ from servo.views.gsx import create_repair, edit_repair, import_repair
urlpatterns = [
url(r'^$', list_orders, name='orders-index'),
- url(r'^\?queue=(?P<queue>\d+)$', list_orders, name='orders-list_queue'),
url(r'^batch/$', batch_process, name="orders-batch_process"),
url(r'^download/$', download_results, name="orders-download_results"),
@@ -34,7 +33,8 @@ urlpatterns = [
name="repairs-complete_repair"),
url(r'^(\d+)/device/(\d+)/queue/(\d+)/parts/$', parts,
name="orders-list_parts"),
- url(r'^(\d+)/remove_device/(\d+)/$', remove_device, name='orders-delete_device'),
+ url(r'^(\d+)/remove_device/(\d+)/$', remove_device,
+ name='orders-delete_device'),
url(r'^(?P<pk>\d+)/add_device/(?P<device_id>\d+)/$', add_device,
name="orders-add_device"),
@@ -49,42 +49,67 @@ urlpatterns = [
url(r'^(\d+)/tags/(\d+)/toggle/$', toggle_tag, name='orders-toggle_tag'),
url(r'^(\d+)/tasks/(\d+)/toggle/$', toggle_task, name='orders-toggle_task'),
url(r'^(\d+)/dispatch/$', create_invoice, name='orders-dispatch'),
- url(r'^(\d+)/products/reserve/$', reserve_products, name="orders-reserve_products"),
+ url(r'^(\d+)/products/reserve/$', reserve_products,
+ name="orders-reserve_products"),
url(r'^(\d+)/products/(\d+)/create_device/$', device_from_product,
name="orders-create_device"),
- url(r'^(?P<pk>\d+)/customer/choose/', choose_customer, name="orders-choose_customer"),
- url(r'^(?P<pk>\d+)/customer/(?P<customer_id>\d+)/select/$', select_customer,
+ url(r'^(?P<pk>\d+)/customer/choose/', choose_customer,
+ name="orders-choose_customer"),
+ url(r'^(?P<pk>\d+)/customer/(?P<customer_id>\d+)/select/$',
+ select_customer,
name="orders-select_customer"),
- url(r'^(?P<pk>\d+)/customer/(?P<customer_id>\d+)/remove/$', remove_customer,
+ url(r'^(?P<pk>\d+)/customer/(?P<customer_id>\d+)/remove/$',
+ remove_customer,
name="orders-remove_customer"),
- url(r'^create/product/(?P<product_id>\d+)/$', create, name="orders-create_with_product"),
- url(r'^create/note/(?P<note_id>\d+)/$', create, name="orders-create_with_note"),
- url(r'^create/device/(?P<device_id>\d+)/$', create, name='orders-create_with_device'),
- url(r'^create/sn/(?P<sn>\w+)?/$', create, name='orders-create_with_sn'),
- url(r'^create/customer/(?P<customer_id>\d+)?/$', create, name="orders-create_with_customer"),
-
- url(r'^(?P<pk>\d+)/device/(?P<device_id>\d+)/accessories/$', accessories,
+ url(r'^create/product/(?P<product_id>\d+)/$',
+ create,
+ name="orders-create_with_product"),
+ url(r'^create/note/(?P<note_id>\d+)/$',
+ create,
+ name="orders-create_with_note"),
+ url(r'^create/device/(?P<device_id>\d+)/$',
+ create,
+ name='orders-create_with_device'),
+ url(r'^create/sn/(?P<sn>\w+)?/$',
+ create,
+ name='orders-create_with_sn'),
+ url(r'^create/customer/(?P<customer_id>\d+)?/$',
+ create,
+ name="orders-create_with_customer"),
+
+ url(r'^(?P<pk>\d+)/device/(?P<device_id>\d+)/accessories/$',
+ accessories,
name='orders-accessories'),
url(r'^(?P<order_id>\d+)/device/(?P<device_id>\d+)/accessories/(?P<pk>\d+)/delete/$',
- delete_accessory, name='orders-delete_accessory'),
+ delete_accessory,
+ name='orders-delete_accessory'),
- url(r'^(?P<pk>\d+)/print/(?P<kind>\w+)?/$', put_on_paper, name="orders-print_order"),
+ url(r'^(?P<pk>\d+)/print/(?P<kind>\w+)?/$',
+ put_on_paper,
+ name="orders-print_order"),
- url(r'^(?P<pk>\d+)/products/(?P<item_id>\d+)/remove/$', remove_product,
+ url(r'^(?P<pk>\d+)/products/(?P<item_id>\d+)/remove/$',
+ remove_product,
name='orders-remove_product'),
- url(r'^(?P<pk>\d+)/products/(?P<product_id>\d+)/add/$', add_product,
+ url(r'^(?P<pk>\d+)/products/(?P<product_id>\d+)/add/$',
+ add_product,
name="orders-add_product"),
- url(r'^(?P<pk>\d+)/devices/(?P<device>\d+)/parts/(?P<code>[\w\-/]+)/add/$', add_part,
+ url(r'^(?P<pk>\d+)/devices/(?P<device>\d+)/parts/(?P<code>[\w\-/]+)/add/$',
+ add_part,
name="orders-add_part"),
- url(r'^(?P<pk>\d+)/devices/(?P<device>\d+)/history/$', history,
+ url(r'^(?P<pk>\d+)/devices/(?P<device>\d+)/history/$',
+ history,
name="orders-history"),
- url(r'^(?P<pk>\d+)/products/(?P<item_id>\d+)/report/$', report_product,
+ url(r'^(?P<pk>\d+)/products/(?P<item_id>\d+)/report/$',
+ report_product,
name="orders-report_product"),
- url(r'^(?P<pk>\d+)/devices/(?P<device_id>\d+)/report/$', report_device,
+ url(r'^(?P<pk>\d+)/devices/(?P<device_id>\d+)/report/$',
+ report_device,
name="orders-report_device"),
- url(r'^(?P<pk>\d+)/products/(?P<item_id>\d+)/edit/$', edit_product,
+ url(r'^(?P<pk>\d+)/products/(?P<item_id>\d+)/edit/$',
+ edit_product,
name="orders-edit_product"),
url(r'^(?P<pk>\d+)/products/(?P<item_id>\d+)/(?P<action>\w+)/$', products),