You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
3.2 KiB
82 lines
3.2 KiB
# -*- coding: utf-8 -*-
|
|
from django.core.context_processors import csrf
|
|
from django.shortcuts import render_to_response
|
|
from django.template import RequestContext
|
|
from django.views.generic import TemplateView
|
|
from django.conf import settings
|
|
from exposition.models import Exposition
|
|
from theme.models import Theme
|
|
from news.models import News
|
|
from article.models import Article
|
|
|
|
from functions.forms import ThemeSearch, PlaceSearch
|
|
|
|
from functions.search_forms import EventSearchForm, ExpositionSearchForm
|
|
from functions.custom_views import ExpoListView
|
|
from accounts.forms import RegistrationCompleteForm
|
|
|
|
def expo_context(request):
|
|
cont = {'theme_search_form': ThemeSearch(), 'expo_catalog': Exposition.catalog,
|
|
'book_aid': settings.BOOKING_AID}
|
|
|
|
user = request.user
|
|
if not user.is_anonymous() and not user.url:
|
|
cont.update({'reg_complete': RegistrationCompleteForm(instance=user)})
|
|
if not request.GET:
|
|
cont.update({'search_form': ExpositionSearchForm()})
|
|
|
|
|
|
return cont
|
|
|
|
|
|
class MainPageView(TemplateView):
|
|
template_name = 'index.html'
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super(MainPageView, self).get_context_data(**kwargs)
|
|
events = Exposition.objects.all().order_by('-main_page')[:5]
|
|
exposition_themes = Theme.objects.order_by('-main_page').filter(types=Theme.types.exposition)[:6]
|
|
conference_themes = Theme.objects.order_by('-main_page').filter(types=Theme.types.conference)[:6]
|
|
seminar_themes = Theme.objects.order_by('-main_page').filter(types=Theme.types.seminar)[:6]
|
|
news_list = News.objects.order_by('-main_page').all()[:3]
|
|
articles = Article.objects.order_by('-main_page').all()[:2]
|
|
|
|
args = {'events': events, 'exposition_themes': exposition_themes,
|
|
'conference_themes': conference_themes, 'seminar_themes': seminar_themes,
|
|
'news_list': news_list, 'articles': articles, 'search_form': EventSearchForm,
|
|
'search_action': '/events/search/'}
|
|
|
|
|
|
context.update(args)
|
|
|
|
return context
|
|
|
|
class MainPageViewTest(TemplateView):
|
|
template_name = 'client/main_page.html'
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super(MainPageViewTest, self).get_context_data(**kwargs)
|
|
events = Exposition.objects.all().order_by('-main_page')[:5]
|
|
exposition_themes = Theme.objects.order_by('-main_page').filter(types=Theme.types.exposition)[:6]
|
|
conference_themes = Theme.objects.order_by('-main_page').filter(types=Theme.types.conference)[:6]
|
|
seminar_themes = Theme.objects.order_by('-main_page').filter(types=Theme.types.seminar)[:6]
|
|
news_list = News.objects.order_by('-main_page').all()[:3]
|
|
articles = Article.objects.order_by('-main_page').all()[:2]
|
|
|
|
args = {'events': events, 'exposition_themes': exposition_themes,
|
|
'conference_themes': conference_themes, 'seminar_themes': seminar_themes,
|
|
'news_list': news_list, 'articles': articles}
|
|
|
|
|
|
context.update(args)
|
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
class AdvertisingView(TemplateView):
|
|
template_name = 'simple_pages/advertising.html'
|
|
|
|
class AboutView(TemplateView):
|
|
template_name = 'simple_pages/about.html' |