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.
 
 
 
 
 
 

64 lines
2.6 KiB

# -*- coding: utf-8 -*-
from django.core.context_processors import csrf
from django.shortcuts import render_to_response
from django.template import RequestContext
from exposition.models import Exposition
from theme.models import Theme
from news.models import News
from article.models import Article
from django.views.generic import TemplateView
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}
context.update(args)
return context
def home(request):
#reg_form = RegistrationFormUniqueEmail()
#login_form = LoginForm()
#args = {'reg_form': reg_form, 'login_form': login_form}
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}
args.update(csrf(request))
return render_to_response('index.html', args, context_instance=RequestContext(request))
from django.views.generic import View, ListView, DetailView
from django.http import HttpResponse
from country.models import Country
from functions.views_help import split_params
from functions.custom_views import ExpoListView
class Test(ExpoListView):
model = Exposition
from django.views.generic import TemplateView
class AdvertisingView(TemplateView):
template_name = 'advertising.html'