aboutsummaryrefslogtreecommitdiffstats
path: root/servo/views
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-08-18 23:37:05 +0300
committerFilipp Lepalaan <filipp@mac.com>2015-08-18 23:37:05 +0300
commit09731610e0c037a3c6a6068d71f4dca887389f26 (patch)
treea62710dc46138189d4c7f8e7a7d8363f9fdb8baf /servo/views
parent12a991f475e38cb7e2a32ef3afb4b733aeae4771 (diff)
downloadServo-09731610e0c037a3c6a6068d71f4dca887389f26.tar.gz
Servo-09731610e0c037a3c6a6068d71f4dca887389f26.tar.bz2
Servo-09731610e0c037a3c6a6068d71f4dca887389f26.zip
Fixed session problems in stats
Diffstat (limited to 'servo/views')
-rw-r--r--servo/views/stats.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/servo/views/stats.py b/servo/views/stats.py
index 5ca66f8..0822373 100644
--- a/servo/views/stats.py
+++ b/servo/views/stats.py
@@ -98,7 +98,7 @@ def index(request):
if request.method == 'POST':
form = TechieStatsForm(request.POST, initial=data['initial'])
if form.is_valid():
- request.session['stats_filter'] = form.cleaned_data
+ request.session['stats_filter'] = form.serialize()
data['form'] = form
return render(request, "stats/index.html", data)
@@ -207,11 +207,7 @@ def data(request, query):
result.append({'label': i.title, 'data': data})
if report == "status":
- try:
- status = params.get('status').title
- except AttributeError:
- return HttpResponse(json.dumps(result))
-
+ status = params.get('status')
if what == "location":
for i in locations.all():
data = stats.statuses_per_location(
@@ -298,7 +294,7 @@ def sales(request):
if request.method == 'POST':
form = InvoiceStatsForm(request.POST, initial=data['initial'])
if form.is_valid():
- request.session['stats_filter'] = form.cleaned_data
+ request.session['stats_filter'] = form.serialize()
data['form'] = form
return render(request, "stats/sales.html", data)
@@ -310,7 +306,7 @@ def queues(request):
if request.method == 'POST':
form = OrderStatsForm(request.POST, initial=data['initial'])
if form.is_valid():
- request.session['stats_filter'] = form.cleaned_data
+ request.session['stats_filter'] = form.serialize()
data['form'] = form
return render(request, "stats/queues.html", data)
@@ -322,7 +318,7 @@ def locations(request):
if request.method == 'POST':
form = BasicStatsForm(request.POST, initial=data['initial'])
if form.is_valid():
- request.session['stats_filter'] = form.cleaned_data
+ request.session['stats_filter'] = form.serialize()
data['form'] = form
return render(request, "stats/locations.html", data)
@@ -333,7 +329,12 @@ def statuses(request):
if request.method == 'POST':
form = StatusStatsForm(request.POST, initial=data['initial'])
if form.is_valid():
- request.session['stats_filter'] = form.cleaned_data
+ # Store the name of the status since we don't have
+ # IDs in events, yet
+ status = form.cleaned_data['status'].title
+ f = form.serialize()
+ f['status'] = status
+ request.session['stats_filter'] = f
data['form'] = form
return render(request, "stats/statuses.html", data)