diff --git a/conference/views.py b/conference/views.py index c01ce80c..bbbc63c6 100644 --- a/conference/views.py +++ b/conference/views.py @@ -10,6 +10,8 @@ from django.views.generic import ListView, DetailView from django.views.generic.edit import FormMixin from django.utils.translation import ugettext as _ from django.utils import translation +from service.models import Service +from service.views import order_forms from note.models import Note from models import Conference from accounts.models import User @@ -17,7 +19,6 @@ from country.models import Country from city.models import City from theme.models import Theme, Tag from service.order_forms import AdvertiseForm -from functions.search_forms import ExpositionSearchForm from meta.views import MetadataMixin from functions.cache_mixin import JitterCacheMixin, CacheMixin @@ -97,7 +98,6 @@ class ConferenceCatalog(JitterCacheMixin, MetadataMixin, ListView): model = Conference paginate_by = settings.CLIENT_PAGINATION template_name = 'client/conference/catalog.html' - search_form = ExpositionSearchForm filter_object = None year = None month = None @@ -152,10 +152,8 @@ class ConferenceCatalog(JitterCacheMixin, MetadataMixin, ListView): return qs.order_by('data_begin') - def get_context_data(self, **kwargs): context = super(ConferenceCatalog, self).get_context_data(**kwargs) - context['search_form'] = self.search_form context['filter_object'] = self.filter_object context['year'] = self.year context['month'] = self.month @@ -164,6 +162,7 @@ class ConferenceCatalog(JitterCacheMixin, MetadataMixin, ListView): class ConferenceCountryCatalog(ConferenceCatalog): catalog_url = '/conference/country/' + def get_filtered_qs(self): #this method used in parent get_queryset slug = self.kwargs.get('slug') @@ -173,6 +172,12 @@ class ConferenceCountryCatalog(ConferenceCatalog): qs = self.model.enable.upcoming().filter(country=country) return qs + def get_context_data(self, **kwargs): + context = super(ConferenceCountryCatalog, self).get_context_data(**kwargs) + context['country'] = str(self.kwargs['country'].id) + return context + + class ConferenceCityCatalog(ConferenceCatalog): catalog_url = '/conference/city/' def get_filtered_qs(self): @@ -184,6 +189,11 @@ class ConferenceCityCatalog(ConferenceCatalog): self.filter_object = city return qs + def get_context_data(self, **kwargs): + context = super(ConferenceCityCatalog, self).get_context_data(**kwargs) + context['city'] = str(self.kwargs['city'].id) + return context + class ConferenceThemeCatalog(ConferenceCatalog): template_name = 'conference/catalog_theme.html' @@ -219,6 +229,9 @@ class ConferenceThemeCatalog(ConferenceCatalog): context['country'] = self.country if self.city: context['city'] = self.city + + context['theme_for_filter'] = self.kwargs['theme'] + context['themes'] = [str(self.kwargs['theme'].id)] return context @@ -233,16 +246,20 @@ class ConferenceTagCatalog(ConferenceCatalog): self.filter_object = tag return qs + def get_context_data(self, **kwargs): + context = super(ConferenceTagCatalog, self).get_context_data(**kwargs) + tag = self.kwargs['tag'] + context['theme_for_filter'] = tag.theme + context['themes'] = [str(tag.theme.id)] + context['tag'] = str(self.kwargs['tag'].id) + return context + class ConferenceVisitors(MetadataMixin, ListView): paginate_by = settings.CLIENT_PAGINATION model = Conference - #template_name = 'event_visitors.html' - template_name = 'client/conference/visitors.html' - obj = None - search_form = ExpositionSearchForm def get_queryset(self): slug = self.kwargs.get('slug') @@ -252,20 +269,19 @@ class ConferenceVisitors(MetadataMixin, ListView): def get_context_data(self, **kwargs): context = super(ConferenceVisitors, self).get_context_data(**kwargs) - context['object'] = self.obj - context['search_form'] = self.search_form + obj = self.obj + context['object'] = obj + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] return context class ConferenceMembers(MetadataMixin, ListView): paginate_by = settings.CLIENT_PAGINATION model = Conference - #template_name = 'event_visitors.html' - template_name = 'client/conference/members.html' - obj = None - search_form = ExpositionSearchForm def get_queryset(self): slug = self.kwargs.get('slug') @@ -275,12 +291,14 @@ class ConferenceMembers(MetadataMixin, ListView): def get_context_data(self, **kwargs): context = super(ConferenceMembers, self).get_context_data(**kwargs) - context['object'] = self.obj - context['search_form'] = self.search_form + obj = self.obj + context['object'] = obj + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] return context -from service.models import Service -from service.views import order_forms + class ConferenceThankView(MetadataMixin, DetailView): model = Conference @@ -324,7 +342,11 @@ class ConferenceServiceView(FormMixin, DetailView): raise Http404 context['form'] = self.get_form(self.form_class) context['service'] = service - context['object'] = self.get_object() + obj = self.get_object() + context['object'] = obj + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] return context def form_valid(self, form): @@ -347,14 +369,11 @@ class ConferenceServiceView(FormMixin, DetailView): 'city':user.profile.city.name if user.profile.city else '', 'phone': user.profile.phone if user.profile.phone else ''} - - return initial else: return self.initial.copy() - class ConferenceDetail(JitterCacheMixin, DetailView): cache_range = settings.CACHE_RANGE model = Conference @@ -370,19 +389,21 @@ class ConferenceDetail(JitterCacheMixin, DetailView): except City.DoesNotExist: return super(ConferenceDetail, self).dispatch(request, *args, **kwargs) - - def get_context_data(self, **kwargs): context = super(ConferenceDetail, self).get_context_data(**kwargs) context['advertising_form'] = AdvertiseForm() + obj = self.object + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] return context + class ConferenceList(MetadataMixin, JitterCacheMixin, ListView): cache_range = settings.CACHE_RANGE model = Conference paginate_by = settings.CLIENT_PAGINATION template_name = 'client/conference/conference_list.html' - search_form = ExpositionSearchForm catalog_url = '/conference/' year = None month = None @@ -410,7 +431,6 @@ class ConferenceList(MetadataMixin, JitterCacheMixin, ListView): context = super(ConferenceList, self).get_context_data(**kwargs) context['month'] = self.month context['catalog_url'] = self.catalog_url - context['search_form'] = self.search_form context['year'] = self.year context['month'] = self.month return context diff --git a/core/views.py b/core/views.py index 9545b925..9e0af308 100644 --- a/core/views.py +++ b/core/views.py @@ -244,7 +244,7 @@ class DeletePage(DeleteView): class PageDetailed(DetailView): model = Page - template_name = 'client/base_page.html' + template_name = 'client/base_catalog.html' slug_field = 'url' slug_url_kwarg = 'url' diff --git a/expobanner/forms.py b/expobanner/forms.py index f489d731..5c3b6473 100644 --- a/expobanner/forms.py +++ b/expobanner/forms.py @@ -164,13 +164,13 @@ class TopCreateForm(forms.ModelForm): theme_ids = self.cleaned_data['theme'] if theme_ids: return Theme.objects.filter(id__in=theme_ids) - return None + return Theme.objects.none() def clean_country(self): country_ids = self.cleaned_data['country'] if country_ids: return Country.objects.filter(id__in=country_ids) - return None + return Country.objects.none() def clean_exposition(self): expo_id = self.cleaned_data['exposition'] diff --git a/expobanner/models.py b/expobanner/models.py index e543b29e..b49c914f 100644 --- a/expobanner/models.py +++ b/expobanner/models.py @@ -255,6 +255,11 @@ class Top(models.Model, StatMixin): class Meta: ordering = ['position'] + def get_event(self): + try: + return self.exposition_set.all()[0] + except IndexError: + return None class TopStat(models.Model): date = models.DateField() diff --git a/expobanner/utils.py b/expobanner/utils.py index a7a9cd53..9c4222a2 100644 --- a/expobanner/utils.py +++ b/expobanner/utils.py @@ -21,22 +21,21 @@ def get_by_sort(banner_list): def get_banner_by_params(banners_list, urls, params): - #print('START. NUMBER of queries = %d'%len(connection.queries)) thematic_banners = [] url_banners = [] for banner in banners_list: - #print('-------------------------') - #print('number of queries = %d'%len(connection.queries)) - # check by theme banner_theme_ids = [str(theme.id) for theme in banner.theme.all()] - #print('number of queries = %d'%len(connection.queries)) - if banner_theme_ids: if params.get('theme'): theme = params['theme'] - if theme in banner_theme_ids: + + flag = False + for th in theme: + if th in banner_theme_ids: + flag = True + if flag: thematic_banners.append(banner) continue # check by country @@ -63,7 +62,7 @@ def get_banner_by_params(banners_list, urls, params): if common_urls: url_banners.append(banner) continue - print('-------------------------') + if thematic_banners: return random.choice(thematic_banners) if url_banners: @@ -71,3 +70,43 @@ def get_banner_by_params(banners_list, urls, params): return None #print('END. NUMBER of queries = %d'%len(connection.queries)) + +def get_top_events(tops, params): + catalog = params.get('catalog') + country = params.get('country', '') + theme = params.get('theme', []) + city = params.get('city', '') + tag = params.get('tag', '') + catalog_tops = [item for item in tops if item.catalog == catalog] + good_tops = [] + for top in catalog_tops: + + country_ids = [str(item.id) for item in top.country.all()] + theme_ids = [str(item.id) for item in top.theme.all()] + excluded_tags_ids = [str(item.id) for item in top.excluded_tags.all()] + excluded_cities_ids = [str(item.id) for item in top.excluded_cities.all()] + if not country_ids and not theme_ids: + # universal top + good_tops.append(top) + continue + # check country + if country in country_ids and city not in excluded_cities_ids : + good_tops.append(top) + continue + # check theme + if tag in excluded_tags_ids: + continue + flag = False + for th in theme: + if th in theme_ids: + flag = True + continue + if flag: + good_tops.append(top) + sorted_top = sorted(good_tops, key=lambda x: x.position) + events = [] + for top in sorted_top: + event = top.get_event() + if event: + events.append(event) + return events \ No newline at end of file diff --git a/expobanner/views.py b/expobanner/views.py index d0e38527..96540cdc 100644 --- a/expobanner/views.py +++ b/expobanner/views.py @@ -3,8 +3,10 @@ import json import re from django.http import HttpResponse from django.shortcuts import redirect, get_object_or_404 +from django.shortcuts import render_to_response +from django.template import RequestContext from .models import Banner, BannerGroup, URL, Top -from expobanner.utils import get_by_sort, get_banner_by_params, get_client_ip +from expobanner.utils import get_by_sort, get_banner_by_params, get_client_ip, get_top_events def click(request, banner_id): @@ -32,7 +34,7 @@ def get_banners(request): elif url == u.url: good_urls.append(u) # fill parameters dict - params = {'theme': request.GET.get('theme'), + params = {'theme': request.GET.getlist('theme', []), 'tag': request.GET.get('tag'), 'country': request.GET.get('country'), 'city': request.GET.get('city'), @@ -69,25 +71,8 @@ def get_banners(request): return HttpResponse(json.dumps(result, indent=4), content_type='application/json') -def get_top_events(tops, params): - catalog = params.get('catalog') - country = params.get('country', '') - theme = params.get('theme', []) - good_tops = [] - for top in tops: - - if top.catalog != catalog: - continue - country_ids = [str(item.id) for item in top.country.all()] - if not country in country_ids: - continue - - -from exposition.models import Exposition -from django.shortcuts import render_to_response -from django.template import RequestContext def get_top(request): - params = {'theme': request.GET.get('theme'), + params = {'theme': request.GET.getlist('theme', []), 'tag': request.GET.get('tag'), 'country': request.GET.get('country'), 'city': request.GET.get('city'), @@ -95,6 +80,5 @@ def get_top(request): tops = Top.cached.all() events = get_top_events(tops, params) - expos = Exposition.objects.filter(top__isnull=False) - context = {'objects': expos} + context = {'objects': events} return render_to_response('client/includes/exposition/expo_top.html', context, context_instance=RequestContext(request)) \ No newline at end of file diff --git a/exposition/views.py b/exposition/views.py index b6464599..43f5fb8f 100644 --- a/exposition/views.py +++ b/exposition/views.py @@ -2,14 +2,14 @@ import json import datetime from django.http import HttpResponseRedirect, HttpResponse, HttpResponsePermanentRedirect -from django.contrib import messages from django.contrib.contenttypes.models import ContentType from django.conf import settings from django.views.generic import ListView, DetailView from django.utils.translation import ugettext as _ -from django.shortcuts import get_object_or_404, render_to_response +from django.shortcuts import get_object_or_404 from django.http import Http404 -from django.utils import translation +from django.views.generic.edit import FormMixin +from django.core.mail import EmailMessage #models from accounts.models import User from models import Exposition @@ -23,9 +23,7 @@ from service.order_forms import AdvertiseForm from functions.search_forms import ExpositionSearchForm from functions.custom_views import ExpoSearchView from meta.views import MetadataMixin -from functions.cache_mixin import JitterCacheMixin, CacheMixin - - +from functions.cache_mixin import JitterCacheMixin class ExpositionBy(JitterCacheMixin, MetadataMixin, ListView): @@ -156,12 +154,28 @@ class ExpoDetail(JitterCacheMixin, MetadataMixin, DetailView): def get_context_data(self, **kwargs): context = super(ExpoDetail, self).get_context_data(**kwargs) context['advertising_form'] = AdvertiseForm() + obj = self.object + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] + return context + class ExpositionProgramme(MetadataMixin, DetailView): model = Exposition slug_field = 'url' template_name = 'client/exposition/programm.html' + queryset = Exposition.objects.language().select_related('place', 'city', 'country', 'paid_new') + + def get_context_data(self, **kwargs): + context = super(ExpositionProgramme, self).get_context_data(**kwargs) + obj = self.object + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] + + return context class ExpositionPrice(MetadataMixin, DetailView): @@ -170,20 +184,47 @@ class ExpositionPrice(MetadataMixin, DetailView): template_name = 'client/exposition/price.html' queryset = Exposition.objects.language().select_related('place', 'city', 'country', 'paid_new') + def get_context_data(self, **kwargs): + context = super(ExpositionPrice, self).get_context_data(**kwargs) + obj = self.object + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] + + return context class ExpositionStatistic(MetadataMixin, DetailView): model = Exposition slug_field = 'url' template_name = 'client/exposition/statistic.html' + queryset = Exposition.objects.language().select_related('place', 'city', 'country', 'paid_new') + + def get_context_data(self, **kwargs): + context = super(ExpositionStatistic, self).get_context_data(**kwargs) + obj = self.object + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] + + return context -from django.views.generic.edit import FormMixin, ModelFormMixin class ExpositionThankView(MetadataMixin, DetailView): model = Exposition slug_field = 'url' template_name = 'client/service/thank_u_page.html' + def get_context_data(self, **kwargs): + context = super(ExpositionThankView, self).get_context_data(**kwargs) + obj = self.object + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] + + return context + + def visit_redirect(request, slug): obj = get_object_or_404(Exposition, url=slug) redirect = obj.get_permanent_url() + 'price/' @@ -226,7 +267,12 @@ class ExpositionServiceView(MetadataMixin, FormMixin, DetailView): raise Http404 context['form'] = self.get_form(self.form_class) context['service'] = self.service - context['object'] = self.get_object() + obj = self.get_object() + context['object'] = obj + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] + return context def form_valid(self, form): @@ -248,8 +294,6 @@ class ExpositionServiceView(MetadataMixin, FormMixin, DetailView): 'city':user.profile.city.name if user.profile.city else '', 'phone': user.profile.phone if user.profile.phone else ''} - - return initial else: return self.initial.copy() @@ -260,12 +304,12 @@ class ExpoList(MetadataMixin, JitterCacheMixin, ListView): model = Exposition paginate_by = settings.CLIENT_PAGINATION template_name = 'client/exposition/exposition_list.html' - search_form = ExpositionSearchForm catalog_url = '/expo/' year = None month = None def get_queryset(self): + MONTHES = settings.MONTHES if self.request.user.is_staff: qs = self.model.objects.upcoming() else: @@ -286,24 +330,21 @@ class ExpoList(MetadataMixin, JitterCacheMixin, ListView): context = super(ExpoList, self).get_context_data(**kwargs) context['month'] = self.month context['catalog_url'] = self.catalog_url - context['search_form'] = self.search_form context['year'] = self.year context['month'] = self.month return context -MONTHES = settings.MONTHES + class ExpoCatalog(MetadataMixin, ListView): model = Exposition paginate_by = settings.CLIENT_PAGINATION template_name = 'client/exposition/catalog.html' - search_form = ExpositionSearchForm filter_object = None year = None month = None country = None city = None - paid = None def get_filtered_qs(self): # diferent for views @@ -352,12 +393,8 @@ class ExpoCatalog(MetadataMixin, ListView): return qs.order_by('data_begin') - def get_context_data(self, **kwargs): context = super(ExpoCatalog, self).get_context_data(**kwargs) - if self.paid: - context['paid'] = self.paid - context['search_form'] = self.search_form context['filter_object'] = self.filter_object context['year'] = self.year context['month'] = self.month @@ -366,6 +403,7 @@ class ExpoCatalog(MetadataMixin, ListView): context['tag_for_filter'] = self.kwargs['tag'] return context + class ExpoCountryCatalog(ExpoCatalog): catalog_url = '/expo/country/' def get_filtered_qs(self): @@ -382,6 +420,7 @@ class ExpoCountryCatalog(ExpoCatalog): context['country'] = str(self.kwargs['country'].id) return context + class ExpoCityCatalog(ExpoCatalog): catalog_url = '/expo/city/' def get_filtered_qs(self): @@ -411,11 +450,8 @@ class ExpoThemeCatalog(ExpoCatalog): city_slug = self.kwargs.get('city_slug') theme = get_object_or_404(Theme, url=slug) self.kwargs['theme'] = theme + qs = self.model.enable.upcoming().filter(theme=theme) - qs = self.model.enable.upcoming().filter(theme=theme).exclude(paid__isnull=False) - paid= list(self.model.enable.filter(theme=theme).filter(paid__isnull=False)) - if paid: - self.paid = paid if country_slug: country = get_object_or_404(Country, url=country_slug) self.country = country @@ -434,9 +470,9 @@ class ExpoThemeCatalog(ExpoCatalog): def get_context_data(self, **kwargs): context = super(ExpoThemeCatalog, self).get_context_data(**kwargs) if self.country: - context['country'] = str(self.country.id) + context['country'] = self.country if self.city: - context['city'] = str(self.city.id) + context['city'] = self.city context['theme_for_filter'] = self.kwargs['theme'] context['themes'] = [str(self.kwargs['theme'].id)] return context @@ -444,16 +480,13 @@ class ExpoThemeCatalog(ExpoCatalog): class ExpoTagCatalog(ExpoCatalog): catalog_url = '/expo/tag/' + def get_filtered_qs(self): #this method used in parent get_queryset slug = self.kwargs.get('slug') tag = get_object_or_404(Tag, url=slug) self.kwargs['tag'] = tag - qs = self.model.enable.upcoming().filter(tag=tag).exclude(paid__isnull=False) - paid= list(self.model.enable.filter(tag=tag).filter(paid__isnull=False)) - if paid: - self.paid = paid - + qs = self.model.enable.upcoming().filter(tag=tag) self.filter_object = tag return qs @@ -469,12 +502,8 @@ class ExpoTagCatalog(ExpoCatalog): class ExpoVisitors(MetadataMixin, ListView): paginate_by = settings.CLIENT_PAGINATION model = Exposition - #template_name = 'event_visitors.html' - template_name = 'client/exposition/visitors.html' - obj = None - search_form = ExpositionSearchForm def get_queryset(self): slug = self.kwargs.get('slug') @@ -485,20 +514,19 @@ class ExpoVisitors(MetadataMixin, ListView): def get_context_data(self, **kwargs): context = super(ExpoVisitors, self).get_context_data(**kwargs) - context['object'] = self.obj - context['search_form'] = self.search_form + obj = self.obj + context['object'] = obj + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] return context class ExpoMembers(MetadataMixin, ListView): paginate_by = settings.CLIENT_PAGINATION model = Exposition - #template_name = 'event_visitors.html' - template_name = 'client/exposition/members.html' - obj = None - search_form = ExpositionSearchForm def get_queryset(self): slug = self.kwargs.get('slug') @@ -509,8 +537,11 @@ class ExpoMembers(MetadataMixin, ListView): def get_context_data(self, **kwargs): context = super(ExpoMembers, self).get_context_data(**kwargs) - context['object'] = self.obj - context['search_form'] = self.search_form + obj = self.obj + context['object'] = obj + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) + context['themes'] = [str(item.id) for item in obj.theme.all()] return context @@ -546,11 +577,9 @@ def add_note(request, slug): return HttpResponse(json.dumps(args), content_type='application/json') -from django.core.mail import send_mail -from django.core.mail import EmailMessage def send_to_organiser(request, slug): exposition = get_object_or_404(Exposition, url=slug) - mail_send = exposition.paid.organiser + mail_send = 'evm@expomap.ru' name = request.POST.get('person_inf') email = request.POST.get('person') phone = request.POST.get('phone', '') @@ -562,5 +591,4 @@ def send_to_organiser(request, slug): msg.send() redirect_to = '%sservice/thanks/'%exposition.get_permanent_url() - return HttpResponse(json.dumps({'success':True, 'redirect_to': redirect_to}), content_type='application/json') - + return HttpResponse(json.dumps({'success':True, 'redirect_to': redirect_to}), content_type='application/json') \ No newline at end of file diff --git a/place_exposition/urls.py b/place_exposition/urls.py index 6f68b806..6c40ed2b 100644 --- a/place_exposition/urls.py +++ b/place_exposition/urls.py @@ -1,13 +1,11 @@ # -*- coding: utf-8 -*- from django.conf.urls import patterns, include, url -from views import PlaceSearchView, PlaceDetail, PlaceList, PlaceCityCatalog, PlaceCountryCatalog, PlacePhoto +from views import PlaceDetail, PlaceList, PlaceCityCatalog, PlaceCountryCatalog, PlacePhoto urlpatterns = patterns('', - # correct - url(r'search/', PlaceSearchView.as_view()), - # correct + #url(r'country/$', PlaceCountryCatalog.as_view()), url(r'country/(?P.*)/page/(?P\d+)/$', PlaceCountryCatalog.as_view(), {'meta_id':49}), url(r'country/(?P.*)/$', PlaceCountryCatalog.as_view(), {'meta_id':49}), diff --git a/place_exposition/views.py b/place_exposition/views.py index c72b2c38..a40f28d7 100644 --- a/place_exposition/views.py +++ b/place_exposition/views.py @@ -42,19 +42,11 @@ def place(request, url, photo=None): return render_to_response('photoreport.html', args, context_instance=RequestContext(request)) return render_to_response('place.html', args, context_instance=RequestContext(request)) -from functions.custom_views import ExpoSearchView -from functions.search_forms import PlaceSearchForm -class PlaceSearchView(ExpoSearchView): - #paginate_by = 10 - template_name = 'place/search.html' - search_form = PlaceSearchForm - model = PlaceExposition class PlaceDetail(JitterCacheMixin, MetadataMixin, DetailView): cache_range = settings.CACHE_RANGE model = PlaceExposition - search_form = PlaceSearchForm slug_field = 'url' template_name = 'client/place/place_detail.html' @@ -96,7 +88,9 @@ class PlaceDetail(JitterCacheMixin, MetadataMixin, DetailView): def get_context_data(self, **kwargs): context = super(PlaceDetail, self).get_context_data(**kwargs) - context['search_form'] = self.search_form + obj = self.object + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) return context class PlacePhoto(ListView): @@ -118,7 +112,10 @@ class PlacePhoto(ListView): def get_context_data(self, **kwargs): context = super(PlacePhoto, self).get_context_data(**kwargs) - context['object'] = self.obj + obj = self.obj + context['object'] = obj + context['city'] = str(obj.city_id) + context['country'] = str(obj.country_id) return context @@ -126,7 +123,6 @@ class PlaceList(JitterCacheMixin, MetadataMixin, ListView): model = PlaceExposition paginate_by = 10 template_name = 'client/place/place_list.html' - search_form = PlaceSearchForm def get_queryset(self): @@ -135,11 +131,6 @@ class PlaceList(JitterCacheMixin, MetadataMixin, ListView): conf_qs = PlaceConference.objects.language().all() return list(qs)+list(conf_qs) - def get_context_data(self, **kwargs): - context = super(PlaceList, self).get_context_data(**kwargs) - context['search_form'] = self.search_form - return context - class PlaceCatalog(JitterCacheMixin, MetadataMixin, ListView): cache_range = settings.CACHE_RANGE @@ -170,6 +161,11 @@ class PlaceCountryCatalog(PlaceCatalog): return list(qs) + list(conf_qs) + def get_context_data(self, **kwargs): + context = super(PlaceCountryCatalog, self).get_context_data(**kwargs) + context['country'] = str(self.kwargs['country'].id) + return context + class PlaceCityCatalog(PlaceCatalog): catalog_url = '/places/' @@ -181,4 +177,9 @@ class PlaceCityCatalog(PlaceCatalog): self.filter_object = city qs = self.model.objects.language().select_related('country', 'city').filter(city=city).order_by('-rating') conf_qs = PlaceConference.objects.language().select_related('country', 'city').filter(city=city) - return list(qs) + list(conf_qs) \ No newline at end of file + return list(qs) + list(conf_qs) + + def get_context_data(self, **kwargs): + context = super(PlaceCityCatalog, self).get_context_data(**kwargs) + context['city'] = str(self.kwargs['city'].id) + return context \ No newline at end of file diff --git a/proj/urls.py b/proj/urls.py index a8906dc1..03c2a385 100644 --- a/proj/urls.py +++ b/proj/urls.py @@ -8,7 +8,7 @@ import debug_toolbar from django.views.generic.base import TemplateView class Robot(TemplateView): - template_name = 'robots.txt' + template_name = 'client/robots.txt' content_type = 'text/plain' class YandexCheck(TemplateView): @@ -71,9 +71,7 @@ urlpatterns = patterns('', url(r'^', include('password_reset.urls')), url(r'^i18n/', include('django.conf.urls.i18n')), url(r'^redirect/', include('banners.urls')), - #url(r'^social/', include('social_auth.urls')), url(r'^', include('settings.old_urls')), - #url(r'^search/', include('haystack.urls')), url(r'^', include('service.urls')), ) diff --git a/templates/client/base_catalog.html b/templates/client/base_catalog.html index 106ec884..46746b57 100644 --- a/templates/client/base_catalog.html +++ b/templates/client/base_catalog.html @@ -17,54 +17,33 @@
{% include 'client/includes/online_consult.html' %} - {% include 'client/includes/banners/aside_1.html' %} - {% block aside_banner1 %} - {% if theme_for_filter.id == 27 or theme_for_filter.id == 9 or theme_for_filter.id == 48 %} -
-
- - - -
-
- {% endif %} - {% endblock %} + {% include 'client/includes/banners/aside_1.html' %} {% include 'client/includes/services.html' %}
{% include 'client/includes/announces.html' %} - {% block asside_banner2 %} - - - {% comment %} -
-
- - - -
-
- {% endcomment %} - - - {% endblock %} {% include 'client/includes/side_confs.html' %} +
{% include 'client/includes/banners/aside_2.html' %} +
+
{% include 'client/includes/news.html' with news=news_list %}
+ {% include 'client/includes/banners/aside_3.html' %} {% block aside_vk %} -
- {% include 'client/includes/social_widjet.html' %} -
+
+ {% include 'client/includes/social_widjet.html' %} +
{% endblock %} + {% include 'client/includes/banners/aside_4.html' %} diff --git a/templates/client/base_page.html b/templates/client/base_page.html deleted file mode 100644 index 42d7fcaa..00000000 --- a/templates/client/base_page.html +++ /dev/null @@ -1,113 +0,0 @@ -{% extends 'blank.html' %} - -{% load static %} -{% load i18n %} -{% load template_filters %} - - -{% block main_part %} -
-
- - -
- {% with search_form=search_form %} - {% include 'client/includes/catalog_search.html' %} - {% endwith %} - {% block under_search_baner %} - {% include 'client/includes/banners/under_search.html' %} - {% endblock %} - - {% block bread_scrumbs %} - - {% endblock %} - -
- {% block page_title %} - - {% endblock %} -
- - {% block page_filter %} - {% endblock %} - - {% block page_body %} -
- {% block content_list %} - {% endblock %} - - {% block paginator %} - - - {% endblock %} - - {% block content_footer_banner %} - {% endblock %} -
- - {% block content_text %} - {% comment %} - {% with filter=filter %} - {% include 'includes/event_list_description.html' %} - {% endwith %} - {% endcomment %} - - {% endblock %} - {% endblock %} -
-
-
-{% endblock %} diff --git a/templates/client/blank.html b/templates/client/blank.html index 6b544e58..00219448 100644 --- a/templates/client/blank.html +++ b/templates/client/blank.html @@ -81,7 +81,7 @@ This template include basic anf main styles and js files, - - \ No newline at end of file diff --git a/templates/client/includes/banners/aside_2.html b/templates/client/includes/banners/aside_2.html index 9fdc80bd..439bfe68 100644 --- a/templates/client/includes/banners/aside_2.html +++ b/templates/client/includes/banners/aside_2.html @@ -1,4 +1,24 @@
+ + +
\ No newline at end of file diff --git a/templates/client/includes/banners/catalog_inner.html b/templates/client/includes/banners/catalog_inner.html index 591ea030..ccf1add4 100644 --- a/templates/client/includes/banners/catalog_inner.html +++ b/templates/client/includes/banners/catalog_inner.html @@ -1,3 +1,26 @@
+
\ No newline at end of file diff --git a/templates/client/includes/banners/catalog_inner_2.html b/templates/client/includes/banners/catalog_inner_2.html new file mode 100644 index 00000000..b8ec5c0f --- /dev/null +++ b/templates/client/includes/banners/catalog_inner_2.html @@ -0,0 +1,2 @@ +
+
\ No newline at end of file diff --git a/templates/client/includes/banners/detail_inner.html b/templates/client/includes/banners/detail_inner.html index fe2082ea..6d0760aa 100644 --- a/templates/client/includes/banners/detail_inner.html +++ b/templates/client/includes/banners/detail_inner.html @@ -1,3 +1,25 @@
- +
\ No newline at end of file diff --git a/templates/client/includes/banners/expo_detail.html b/templates/client/includes/banners/expo_detail.html index 29e091ce..405cc617 100644 --- a/templates/client/includes/banners/expo_detail.html +++ b/templates/client/includes/banners/expo_detail.html @@ -1,12 +1,6 @@ {% load static %} {% load template_filters %} -
-{% if object.theme.all.0.id in banner_themes %} - - {% else %} - {% if object.theme.all.1.id in banner_themes %} - - {% endif %} -{% endif %} +
+
\ No newline at end of file diff --git a/templates/client/includes/banners/expo_list_baner.html b/templates/client/includes/banners/expo_list_baner.html deleted file mode 100644 index 792fa3b3..00000000 --- a/templates/client/includes/banners/expo_list_baner.html +++ /dev/null @@ -1,6 +0,0 @@ -{% load static %} -
- {% if theme_for_filter.id in banner_themes or tag_for_filter.id in banner_tags %} - - {% endif %} -
\ No newline at end of file diff --git a/templates/client/includes/banners/header.html b/templates/client/includes/banners/header.html index 41416632..89c7f5a2 100644 --- a/templates/client/includes/banners/header.html +++ b/templates/client/includes/banners/header.html @@ -1,3 +1,12 @@
+ + + +
\ No newline at end of file diff --git a/templates/client/includes/banners/main_page_inner.html b/templates/client/includes/banners/main_page_inner.html new file mode 100644 index 00000000..0a06e549 --- /dev/null +++ b/templates/client/includes/banners/main_page_inner.html @@ -0,0 +1,2 @@ +
+
\ No newline at end of file diff --git a/templates/client/includes/banners/tops.html b/templates/client/includes/banners/tops.html index 0a7d4176..142e63a4 100644 --- a/templates/client/includes/banners/tops.html +++ b/templates/client/includes/banners/tops.html @@ -4,7 +4,7 @@ + {% include 'client/includes/banners/catalog_inner.html' %} {%endif %} {% endfor %} diff --git a/templates/client/includes/conference/conference_object.html b/templates/client/includes/conference/conference_object.html index 6fc8b293..02b61d28 100644 --- a/templates/client/includes/conference/conference_object.html +++ b/templates/client/includes/conference/conference_object.html @@ -196,6 +196,12 @@ {% endif %}
+ +
+
+ {% include 'client/includes/banners/detail_inner.html' %} +
+
diff --git a/templates/client/includes/exposition/expo_list_paid.html b/templates/client/includes/exposition/expo_list_paid.html deleted file mode 100644 index 1b5fdd3e..00000000 --- a/templates/client/includes/exposition/expo_list_paid.html +++ /dev/null @@ -1,154 +0,0 @@ -{% load static %} -{% load i18n %} -{% load template_filters %} -{% with objects=object_list %} - {% if objects %} -
    - - {% for obj in objects %} -
  • -
    - - {% if obj.canceled %} -
    - {% else %} - {% if obj.expohit %} -
    - {% endif %} - {% endif %} -
    - {% with obj=obj %} - {% include 'client/includes/show_logo.html' %} - {% endwith %} -
    -
    -
    -
    - {% if obj.quality_label.ufi.is_set %} -
    - -
    - {% endif %} -
    - -
    -
    - {{ obj.main_title|safe }} -
    -
    -
    -
    - {% with obj=obj %} - {% include 'client/includes/show_date_block.html' %} - {% endwith %} -
    - {% if obj.country %} -
    - {{ obj.country }}, {{ obj.city }} - {% if obj.place %} - , {{ obj.place }} - {% endif %} -
    - {% endif %} -
    -
    -
    -
    - {% include 'client/includes/exposition/services.html' with obj=obj %} - {% include 'client/includes/calendar_button.html' with obj=obj%} -
    - {% with note=obj|note_by_user:request.user %} - {% trans 'заметка' %} -
    -
    - -
    -
    - {% endwith %} -
    - {% if request.user.is_admin %} - - {% endif %} -
    -
    -
    - {% include 'client/buttons/booking_button.html' with object=obj %} -
    -
    -
    -
    -
    - {% if obj.visitors %} - {{ obj.visitors }} - {% endif %} - {% if obj.members %} - {{ obj.members }} - {% endif %} -
    -
    - {% include 'client/includes/exposition/tags.html' with obj=obj %} -
    -
    -
  • - - {% if forloop.counter == 8 %} - - - {%endif %} - {% endfor %} - -
- {% else %} -

- - {% trans "Выставки по указанным параметрам не найдены. Попробуйте задать менее точный запрос по теме или расширить период времени" %} - -

- {% endif %} - -{% endwith %} - - - -{% block scripts %} -{% if request.GET.debug == '1' %} - -{% else %} - -{% endif %} -{% endblock %} \ No newline at end of file diff --git a/templates/client/includes/exposition/exposition_list.html b/templates/client/includes/exposition/exposition_list.html index 5e73135e..6f27536d 100644 --- a/templates/client/includes/exposition/exposition_list.html +++ b/templates/client/includes/exposition/exposition_list.html @@ -100,9 +100,9 @@ - {% if forloop.counter == 5 or objects|length < 5 %} - {% include 'client/includes/banners/expo_list_baner.html' %} - {% endif %} + {% if forloop.counter == 5 or objects|length < 5 %} + {% include 'client/includes/banners/catalog_inner_2.html' %} + {% endif %} {% if forloop.counter == 8 %} {% include 'client/includes/banners/catalog_inner.html' %} diff --git a/templates/client/includes/exposition/exposition_object.html b/templates/client/includes/exposition/exposition_object.html index 8ae51315..dc783ff0 100644 --- a/templates/client/includes/exposition/exposition_object.html +++ b/templates/client/includes/exposition/exposition_object.html @@ -206,10 +206,10 @@
-
-
- {% include 'client/includes/banners/detail_inner.html' %} -
+
+
+ {% include 'client/includes/banners/detail_inner.html' %} +

diff --git a/templates/client/includes/exposition/members.html b/templates/client/includes/exposition/members.html index f9c74e1a..d0bd4e4a 100644 --- a/templates/client/includes/exposition/members.html +++ b/templates/client/includes/exposition/members.html @@ -49,5 +49,12 @@
+ {% if forloop.counter == 5 or objects|length < 5 %} + {% include 'client/includes/banners/catalog_inner_2.html' %} + {% endif %} + + {% if forloop.counter == 8 %} + {% include 'client/includes/banners/catalog_inner.html' %} + {%endif %} {% endfor %} \ No newline at end of file diff --git a/templates/client/includes/exposition/search_result.html b/templates/client/includes/exposition/search_result.html index a387d86c..93bc23af 100644 --- a/templates/client/includes/exposition/search_result.html +++ b/templates/client/includes/exposition/search_result.html @@ -83,6 +83,13 @@
+ {% if forloop.counter == 5 or objects|length < 5 %} + {% include 'client/includes/banners/catalog_inner_2.html' %} + {% endif %} + + {% if forloop.counter == 8 %} + {% include 'client/includes/banners/catalog_inner.html' %} + {%endif %} {% endfor %} {% block scripts %} diff --git a/templates/client/includes/exposition/visitors.html b/templates/client/includes/exposition/visitors.html index ecf0a7d2..0958316b 100644 --- a/templates/client/includes/exposition/visitors.html +++ b/templates/client/includes/exposition/visitors.html @@ -51,6 +51,13 @@ + {% if forloop.counter == 5 or objects|length < 5 %} + {% include 'client/includes/banners/catalog_inner_2.html' %} + {% endif %} + + {% if forloop.counter == 8 %} + {% include 'client/includes/banners/catalog_inner.html' %} + {%endif %} {% endfor %} diff --git a/templates/client/includes/place/place_list.html b/templates/client/includes/place/place_list.html index d5aae814..936a8bf6 100644 --- a/templates/client/includes/place/place_list.html +++ b/templates/client/includes/place/place_list.html @@ -48,6 +48,13 @@ + {% if forloop.counter == 5 or objects|length < 5 %} + {% include 'client/includes/banners/catalog_inner_2.html' %} + {% endif %} + + {% if forloop.counter == 8 %} + {% include 'client/includes/banners/catalog_inner.html' %} + {%endif %} {% endfor %} {% endwith %} \ No newline at end of file diff --git a/templates/client/includes/place/place_object.html b/templates/client/includes/place/place_object.html index 2ca4bd36..9d6b5e10 100644 --- a/templates/client/includes/place/place_object.html +++ b/templates/client/includes/place/place_object.html @@ -287,6 +287,10 @@
{% include 'client/includes/booking_block.html' with city=place.city place=place %}
+
+
+ {% include 'client/includes/banners/detail_inner.html' %} +
{% if place.get_nearest_places %}
{% trans 'Ближайшие выставочные центры' %}
diff --git a/templates/client/index.html b/templates/client/index.html index 96882fb3..a887eb2a 100644 --- a/templates/client/index.html +++ b/templates/client/index.html @@ -55,22 +55,7 @@
- -
- {% block menu_banner %} - {% comment %} - {% if False|random3 == 1 %} - - {% else %} - {% if False|random3 == 2 %} - - {% else %} - - {% endif %} - {% endif %} - {% endcomment %} - {% endblock %} -
+ {% include 'client/includes/banners/main_page_inner.html' %} @@ -159,12 +144,6 @@
{% include 'client/includes/index/blogs.html' with blogs=blogs %} - {% comment %} - -
-
-
- {% endcomment %}
diff --git a/templates/client/page/page_view.html b/templates/client/page/page_view.html index b9e50244..d233787f 100644 --- a/templates/client/page/page_view.html +++ b/templates/client/page/page_view.html @@ -1,4 +1,4 @@ -{% extends 'base_page.html' %} +{% extends 'client/base_catalog.html' %} {% load static %} {% load i18n %} diff --git a/templates/client/place/catalog.html b/templates/client/place/catalog.html index 77939ade..1753dc27 100644 --- a/templates/client/place/catalog.html +++ b/templates/client/place/catalog.html @@ -18,7 +18,7 @@ {% endblock %} {% block content_list %} - {% include 'includes/place/place_list.html' with object_list=object_list %} + {% include 'client/includes/place/place_list.html' with object_list=object_list %} {% endblock %} {% block paginator %} diff --git a/templates/client/robots.txt b/templates/client/robots.txt index f98ce0b4..13f41eb9 100644 --- a/templates/client/robots.txt +++ b/templates/client/robots.txt @@ -97,6 +97,7 @@ Disallow: /*/serv-visa-info.php Disallow: /*/serv-uchastie-info.php Disallow: /*/serv-catalogue-info.php Disallow: /*/serv-catalogs-info.php +Disallow: /expo-b/ Sitemap: http://expomap.ru/sitemap.xml User-agent: Googlebot @@ -198,6 +199,7 @@ Disallow: /*/serv-visa-info.php Disallow: /*/serv-uchastie-info.php Disallow: /*/serv-catalogue-info.php Disallow: /*/serv-catalogs-info.php +Disallow: /expo-b/ Sitemap: http://expomap.ru/sitemap.xml User-agent: Yandex @@ -299,5 +301,6 @@ Disallow: /*/serv-visa-info.php Disallow: /*/serv-uchastie-info.php Disallow: /*/serv-catalogue-info.php Disallow: /*/serv-catalogs-info.php +Disallow: /expo-b/ Host: expomap.ru Sitemap: http://expomap.ru/sitemap.xml \ No newline at end of file diff --git a/templates/registration/acquire_email.html b/templates/registration/acquire_email.html index 17a0c5f0..2aac49a2 100644 --- a/templates/registration/acquire_email.html +++ b/templates/registration/acquire_email.html @@ -1,4 +1,4 @@ -{% extends "client/base_page.html" %} +{% extends "client/base_catalog.html" %} {% block title %}Email confirmation{% endblock %} diff --git a/templates/registration/social_registration_complete.html b/templates/registration/social_registration_complete.html index 755add9b..1f01c1c8 100644 --- a/templates/registration/social_registration_complete.html +++ b/templates/registration/social_registration_complete.html @@ -1,4 +1,4 @@ -{% extends "client/base_page.html" %} +{% extends "client/base_catalog.html" %} {% block title %}Registration complete{% endblock %}