|
|
|
|
@ -1,5 +1,4 @@ |
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
|
|
|
import datetime |
|
|
|
|
import json |
|
|
|
|
|
|
|
|
|
@ -18,12 +17,15 @@ from django.http import ( |
|
|
|
|
) |
|
|
|
|
from django.shortcuts import get_object_or_404 |
|
|
|
|
from django.utils.translation import ugettext as _ |
|
|
|
|
from django.utils import translation |
|
|
|
|
from django.views.generic import DetailView |
|
|
|
|
from django.views.generic.edit import FormMixin |
|
|
|
|
|
|
|
|
|
from functions.cache_mixin import JitterCacheMixin |
|
|
|
|
from functions.custom_views import ExpoSearchView, ListView |
|
|
|
|
from functions.search_forms import ExpositionSearchForm |
|
|
|
|
from functions.views_help import get_side_items |
|
|
|
|
from functions.utils import CachedSting |
|
|
|
|
|
|
|
|
|
from meta.views import MetadataMixin |
|
|
|
|
from models import Exposition |
|
|
|
|
@ -40,6 +42,8 @@ from stats_collector.mixin import ( |
|
|
|
|
from theme.models import Tag, Theme |
|
|
|
|
from events.mixin import ExpoFilterMixin, SearchFilterMixin |
|
|
|
|
|
|
|
|
|
description_templates = settings.DEFAULT_DESCRIPTION |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ExpositionBy(ExpoFilterMixin, ExpoSectionMixin, JitterCacheMixin, MetadataMixin, ListView): |
|
|
|
|
template_name = 'exposition/exposition_by.html' |
|
|
|
|
@ -183,11 +187,18 @@ class ExpoDetail(ObjectStatMixin, JitterCacheMixin, MetadataMixin, DetailView): |
|
|
|
|
queryset = Exposition.objects.language()\ |
|
|
|
|
.select_related('place', 'city', 'country', 'paid_new')\ |
|
|
|
|
.prefetch_related('theme', 'tag') |
|
|
|
|
descriptions = { |
|
|
|
|
'ru': CachedSting(settings.DEFAULT_DESCRIPTION.get('e_description_ru')), |
|
|
|
|
'en': CachedSting(settings.DEFAULT_DESCRIPTION.get('e_description_en')), |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
lang = translation.get_language() |
|
|
|
|
context = super(ExpoDetail, self).get_context_data(**kwargs) |
|
|
|
|
context['advertising_form'] = AdvertiseForm() |
|
|
|
|
obj = self.object |
|
|
|
|
if not obj.description: |
|
|
|
|
context['default_description'] = unicode(self.descriptions[lang]).format(**obj.default_description_context()) |
|
|
|
|
context['city'] = str(obj.city_id) |
|
|
|
|
context['country'] = str(obj.country_id) |
|
|
|
|
context['themes'] = [str(item.id) for item in obj.theme.all()] |
|
|
|
|
|