diff --git a/conference/views.py b/conference/views.py index 888d3f66..a696571b 100644 --- a/conference/views.py +++ b/conference/views.py @@ -193,7 +193,7 @@ class ConferenceCountryCatalog(ConferenceCatalog): def get_context_data(self, **kwargs): context = super(ConferenceCountryCatalog, self).get_context_data(**kwargs) - context['country'] = str(self.kwargs['country'].id) + context['country'] = [str(self.kwargs['country'].id)] return context @@ -211,7 +211,7 @@ class ConferenceCityCatalog(ConferenceCatalog): def get_context_data(self, **kwargs): context = super(ConferenceCityCatalog, self).get_context_data(**kwargs) - context['city'] = str(self.kwargs['city'].id) + context['city'] = [str(self.kwargs['city'].id)] return context @@ -273,7 +273,7 @@ class ConferenceTagCatalog(ConferenceCatalog): tag = self.kwargs['tag'] context['theme_for_filter'] = tag.theme context['themes'] = [str(tag.theme.id)] - context['tag'] = str(self.kwargs['tag'].id) + context['tag'] = [str(self.kwargs['tag'].id)] return context diff --git a/events/mixin.py b/events/mixin.py index ad3d03b1..16e0d4e1 100644 --- a/events/mixin.py +++ b/events/mixin.py @@ -2,10 +2,13 @@ from .common import TYPES + + class BaseFilterMixin(object): def get_context_data(self, **kwargs): context = super(BaseFilterMixin, self).get_context_data(**kwargs) - context['event_type'] = self.event_type + if self.event_type is not None: + context['event_type'] = self.event_type context['can_filter'] = True return context @@ -16,3 +19,7 @@ class ConfFilterMixin(BaseFilterMixin): class ExpoFilterMixin(BaseFilterMixin): event_type = TYPES.EXPO + + +class SearchFilterMixin(BaseFilterMixin): + event_type = None diff --git a/exposition/views.py b/exposition/views.py index c7252e3d..1565d41a 100644 --- a/exposition/views.py +++ b/exposition/views.py @@ -36,7 +36,7 @@ from stats_collector.mixin import ( ObjectStatMixin ) from theme.models import Tag, Theme -from events.mixin import ExpoFilterMixin +from events.mixin import ExpoFilterMixin, SearchFilterMixin class ExpositionBy(ExpoFilterMixin, ExpoSectionMixin, JitterCacheMixin, MetadataMixin, ListView): @@ -114,7 +114,7 @@ class ExpositionByCity(ExpositionBy): # .order_by('translations__name').distinct() -class ExpositionSearchView(ExpoFilterMixin, ExpoSearchView): +class ExpositionSearchView(SearchFilterMixin, ExpoSearchView): #paginate_by = 10 template_name = 'client/exposition/search.html' search_form = ExpositionSearchForm @@ -448,7 +448,7 @@ class ExpoCountryCatalog(ExpoCatalog): def get_context_data(self, **kwargs): context = super(ExpoCountryCatalog, self).get_context_data(**kwargs) - context['country'] = str(self.kwargs['country'].id) + context['country'] = [str(self.kwargs['country'].id)] return context @@ -467,8 +467,8 @@ class ExpoCityCatalog(ExpoCatalog): def get_context_data(self, **kwargs): context = super(ExpoCityCatalog, self).get_context_data(**kwargs) city = self.kwargs['city'] - context['country'] = str(city.country_id) - context['city'] = str(city.id) + context['country'] = [str(city.country_id)] + context['city'] = [str(city.id)] return context @@ -532,7 +532,7 @@ class ExpoTagCatalog(ExpoCatalog): tag = self.kwargs['tag'] context['theme_for_filter'] = tag.theme context['themes'] = [str(tag.theme.id)] - context['tag'] = str(self.kwargs['tag'].id) + context['tag'] = [str(self.kwargs['tag'].id)] return context diff --git a/functions/custom_views.py b/functions/custom_views.py index b01aef14..eb35de97 100644 --- a/functions/custom_views.py +++ b/functions/custom_views.py @@ -408,7 +408,7 @@ class ExpoSearchView(ListView): context['country'] = form.cleaned_data.get('co') if form.cleaned_data.get('ci'): context['city'] = form.cleaned_data.get('ci') - + print(context) else: form = self.search_form() diff --git a/templates/client/blank.html b/templates/client/blank.html index 9cfddc7f..f2e230aa 100644 --- a/templates/client/blank.html +++ b/templates/client/blank.html @@ -56,9 +56,9 @@ This template include basic anf main styles and js files,