def get_filter_result(self, customer_type='',last_contact_filled='', tag_selected='', city_selected=''):
qdict = {}
if customer_type != '':
qdict['type__name'] = customer_type
qdict['active']=True
#MY PROBLEM IS HERE get result that older than last_contact_filled day(s)
if last_contact_filled != '':
for day_filter in xrange(1,int(last_contact_filled)+1):
qdict['last_contact__day']=day_filter
#qdict['last_contact']=last_contact_query
if tag_selected != '':
idtag = tag_selected.split(',')
qdict['tag__id__in']=idtag
if city_selected != '':
idcity = city_selected.split(',')
qdict['city__id__in']=idcity
queryset = Customer.objects.filter(**qdict)
last_contact_filled用户输入的值。
last_contact = forms.IntegerField(widget = forms.TextInput(attrs={'size': '2'}),help_text='day(s)')
例如,如果用户输入33将获得last_contact早于33天的结果