aboutsummaryrefslogtreecommitdiffstats
path: root/servo/views
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-11-09 14:30:24 +0200
committerFilipp Lepalaan <filipp@mac.com>2015-11-09 14:30:24 +0200
commit37bbb1fc01ee14298637ea02208ef1ec35eb1a97 (patch)
treeac0d035ff2d85b22075fb7e8f5580f836908db8f /servo/views
parente6d0c22dcf380d87c9ef93f4a1837e1edc3d7e2b (diff)
downloadServo-37bbb1fc01ee14298637ea02208ef1ec35eb1a97.tar.gz
Servo-37bbb1fc01ee14298637ea02208ef1ec35eb1a97.tar.bz2
Servo-37bbb1fc01ee14298637ea02208ef1ec35eb1a97.zip
Added status_older_than search
Diffstat (limited to 'servo/views')
-rw-r--r--servo/views/order.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/servo/views/order.py b/servo/views/order.py
index cc6d430..80e0077 100644
--- a/servo/views/order.py
+++ b/servo/views/order.py
@@ -42,8 +42,7 @@ def prepare_list_view(request, args):
"""
data = {'title': _("Orders")}
- form = OrderSearchForm(args)
- form.fields['location'].queryset = request.user.locations
+ form = OrderSearchForm(request, args)
if request.session.get("current_queue"):
del(request.session['current_queue'])
@@ -64,6 +63,12 @@ def prepare_list_view(request, args):
end_date = args.get('end_date') or timezone.now()
orders = orders.filter(created_at__range=[start_date, end_date])
+ if args.get("status_older_than"):
+ from datetime import datetime, timedelta
+ days = int(args.get("status_older_than"))
+ limit = datetime.now() - timedelta(days=days)
+ orders = orders.filter(status_started_at__lt=limit)
+
if args.get("assigned_to"):
users = args.getlist("assigned_to")
orders = orders.filter(user__in=users)