|
|
|
|
@ -160,12 +160,6 @@ class FilterForm(forms.Form): |
|
|
|
|
self._lookup_kwargs = None |
|
|
|
|
self._lookup_args = None |
|
|
|
|
self.lang = get_language() |
|
|
|
|
# self.db_cursor = connection.cursor() |
|
|
|
|
# self.selected_filter_data = {} |
|
|
|
|
# self.fields['theme'].queryset = self.get_theme_choices() |
|
|
|
|
# self.fields['tag'].queryset = self.get_tag_choices() |
|
|
|
|
# self.fields['country'].queryset = self.get_country_choices() |
|
|
|
|
# self.fields['city'].queryset = self.get_city_choices() |
|
|
|
|
|
|
|
|
|
def is_valid(self): |
|
|
|
|
# if getattr(self, '_is_valid', None) is None: |
|
|
|
|
@ -234,9 +228,6 @@ class FilterForm(forms.Form): |
|
|
|
|
return qs |
|
|
|
|
|
|
|
|
|
def recalculate_choices(self): |
|
|
|
|
# print(self._is_valid) |
|
|
|
|
# if self._is_valid and self.lookup_kwargs: |
|
|
|
|
|
|
|
|
|
for field in ['theme', 'tag', 'city', 'country']: |
|
|
|
|
# field_qs = self.default_filter(load_all=False) |
|
|
|
|
# if not field_lookup_kwargs: |
|
|
|
|
@ -438,7 +429,7 @@ class FilterForm(forms.Form): |
|
|
|
|
# 'attname': _field.related.field.get_attname(), |
|
|
|
|
} |
|
|
|
|
select = \ |
|
|
|
|
'''SELECT COUNT(DISTINCT `{db_table}`.`{attname}`) FROM `{db_table}`'''\ |
|
|
|
|
'''SELECT COUNT(DISTINCT `{db_table}`.`id`) FROM `{db_table}`'''\ |
|
|
|
|
.format(**_format_kwargs) |
|
|
|
|
# '''SELECT COUNT(`{db_table}`.`id`) FROM `{rel_db_table}` LEFT OUTER JOIN `{db_table}` ON (`{rel_db_table}`.`id` = `{db_table}`.`{attname}`)'''\ |
|
|
|
|
where.append( |
|
|
|
|
|