예제 #1
0
파일: forms.py 프로젝트: jerry-sjtu/sqsite
 def __init__(self, *args, **kwargs):
     q = CommonQuey()
     business = kwargs.pop('business', 1)
     fromdate = kwargs.pop('fromdate', datetime.datetime.now)
     todate = kwargs.pop('todate', datetime.datetime.now)
     #the pop statements should be executed first
     super(CheatQueryFilterForm, self).__init__(*args, **kwargs)
     self.fields['business'] = forms.ChoiceField(q.get_business(),
                                                 initial=business)
     self.fields['fromdate'] = forms.DateField(initial=fromdate)
     self.fields['todate'] = forms.DateField(initial=todate)
예제 #2
0
파일: forms.py 프로젝트: jerry-sjtu/sqsite
class HotqueryFilterForm(forms.Form):
    q = CommonQuey()
    city_list = forms.ChoiceField(q.get_city_list())

    def __init__(self, *args, **kwargs):
        q = CommonQuey()
        business = kwargs.pop('business', 1)
        fromdate = kwargs.pop('fromdate', datetime.datetime.now)
        todate = kwargs.pop('todate', datetime.datetime.now)
        #the pop statements should be executed first
        super(HotqueryFilterForm, self).__init__(*args, **kwargs)
        self.fields['business'] = forms.ChoiceField(q.get_business(),
                                                    initial=business)
        self.fields['fromdate'] = forms.DateField(initial=fromdate)
        self.fields['todate'] = forms.DateField(initial=todate)
        self.fields['algo_list'] = SimpleChoiceFeild(
            q.get_algo_version(business, fromdate, todate))
예제 #3
0
 def test_get_query_process(self):
     k_list = CommonQuey().get_query_process(3, '2013-09-11', '2013-09-18')
     #self.assertTrue(len(k_list)>0)
     pass
예제 #4
0
 def test_get_category(self):
     c_list = CommonQuey().get_category()
     self.assertTrue(len(c_list) > 0)
예제 #5
0
 def test_get_query_type(self):
     query_type = CommonQuey().get_query_type()
     self.assertTrue(len(query_type) > 0)
예제 #6
0
 def test_get_city_list(self):
     city_list = CommonQuey().get_city_list()
     self.assertTrue(len(city_list) > 0)
예제 #7
0
 def test_get_algo_version(self):
     algo_l = CommonQuey().get_algo_version(3, '2013-09-11', '2013-09-18')
     self.assertTrue(True)
예제 #8
0
 def test_get_business(self):
     business_d = CommonQuey().get_business()
     self.assertTrue('主站商户' in business_d)
예제 #9
0
def query_category(request, business, fromdate, todate):
    fromdate = str_to_date(fromdate)
    todate = str_to_date(todate)
    query_category_list = CommonQuey().get_query_category(business, fromdate, todate)
    return HttpResponse(json.dumps(query_category_list), content_type="application/json")
예제 #10
0
def algo_list(request, business, fromdate, todate):
    fromdate = str_to_date(fromdate)
    todate = str_to_date(todate)
    algo_list = CommonQuey().get_algo_version(business, fromdate, todate)
    return HttpResponse(json.dumps(algo_list), content_type="application/json")