From 09731610e0c037a3c6a6068d71f4dca887389f26 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 18 Aug 2015 23:37:05 +0300 Subject: Fixed session problems in stats --- servo/stats/forms.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'servo/stats') diff --git a/servo/stats/forms.py b/servo/stats/forms.py index d1ec2aa..918695f 100644 --- a/servo/stats/forms.py +++ b/servo/stats/forms.py @@ -55,6 +55,19 @@ class BasicStatsForm(forms.Form): widget=DatepickerInput(attrs={'class': "input-small"}) ) + def serialize(self): + import datetime + from django.db.models import Model + cd = self.cleaned_data + + for k, v in cd.iteritems(): + if isinstance(v, datetime.datetime): + cd[k] = str(v) + if isinstance(v, Model): + cd[k] = v.pk + + return cd + class OrderStatsForm(BasicStatsForm): location = forms.ModelChoiceField( -- cgit v1.2.3