aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-11-09 14:17:14 +0200
committerFilipp Lepalaan <filipp@mac.com>2015-11-09 14:17:14 +0200
commite6d0c22dcf380d87c9ef93f4a1837e1edc3d7e2b (patch)
tree7d90cb9a8d31b186a28bfb2fc112bdd35c9c6d9d
parentc682832ea1149d47d375033bc4fc2e2a613f3cd5 (diff)
downloadServo-e6d0c22dcf380d87c9ef93f4a1837e1edc3d7e2b.tar.gz
Servo-e6d0c22dcf380d87c9ef93f4a1837e1edc3d7e2b.tar.bz2
Servo-e6d0c22dcf380d87c9ef93f4a1837e1edc3d7e2b.zip
Fixed Django 1.8.6 query set issue
-rw-r--r--servo/forms/orders.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/servo/forms/orders.py b/servo/forms/orders.py
index a14afa2..ae97e87 100644
--- a/servo/forms/orders.py
+++ b/servo/forms/orders.py
@@ -18,7 +18,7 @@ from servo.forms.base import *
class BatchProcessForm(forms.Form):
orders = forms.CharField(
widget=forms.Textarea,
- label=_("Service order(s)")
+ label=_('Service order(s)')
)
status = forms.ModelChoiceField(
@@ -89,7 +89,7 @@ class OrderSearchForm(forms.Form):
location = forms.ModelMultipleChoiceField(
required=False,
label=_("Location is"),
- queryset=Location.objects.all(),
+ queryset=Location.objects.filter(enabled=True),
)
state = forms.MultipleChoiceField(
required=False,
@@ -123,10 +123,10 @@ class OrderSearchForm(forms.Form):
)
color = forms.MultipleChoiceField(
choices=(
- ('green', _("Green")),
- ('yellow', _("Yellow")),
- ('red', _("Red")),
- ('grey', _("Grey")),
+ ('green', _("Green")),
+ ('yellow', _("Yellow")),
+ ('red', _("Red")),
+ ('grey', _("Grey")),
),
label=_("Color"),
required=False,
@@ -141,3 +141,7 @@ class OrderSearchForm(forms.Form):
label=mark_safe('&nbsp;'),
widget=DatepickerInput(attrs={'class': "input-small"})
)
+
+ def __init__(self, request, *args, **kwargs):
+ super(OrderSearchForm, self).__init__(*args, **kwargs)
+ self.fields['location'].queryset = request.user.locations.all()