фильтр, добавил в выставках и конференциях вывод страны, города, темы в window.sendData как списка

remotes/origin/stage5
Alexander Burdeiny 10 years ago
parent 31583c1e36
commit 0c942fe81c
  1. 6
      conference/views.py
  2. 9
      events/mixin.py
  3. 12
      exposition/views.py
  4. 2
      functions/custom_views.py
  5. 6
      templates/client/blank.html

@ -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

@ -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

@ -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

@ -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()

@ -56,9 +56,9 @@ This template include basic anf main styles and js files,
<script>
window.sendData = {
"theme": [{{ themes|join:", " }}],
"country": "{{ country }}",
"city": "{{ city }}",
"tag": "{{ tag }}",
"country": [{{ country|join:", " }}],
"city": [{{ city|join:", " }}],
"tag": [{{ tag|join:", " }}],
"month": "{{ month.slug }}",
"year": "{{ year.text }}",
"event_type": "{{ event_type }}",

Loading…
Cancel
Save