|
|
|
|
@ -6,9 +6,9 @@ from django.shortcuts import get_object_or_404 |
|
|
|
|
from django.db.models import Sum |
|
|
|
|
from expobanner.models import URL, BannerGroup, Banner, Paid, MainPage, Top |
|
|
|
|
from expobanner.forms import UrlCreateForm, BannerCreateGroupForm, BannerCreateForm, BannerGroupUpdateForm,\ |
|
|
|
|
PaidCreateForm, PaidUpdateForm, TopCreateForm, BannerLinkCreateForm, MainCreateForm, MainUpdateForm, TopUpdateForm |
|
|
|
|
PaidCreateForm, PaidUpdateForm, TopCreateForm, BannerLinkCreateForm, MainCreateForm, MainConfCreateForm, MainUpdateForm, TopUpdateForm |
|
|
|
|
from exposition.models import Exposition |
|
|
|
|
|
|
|
|
|
from conference.models import Conference |
|
|
|
|
|
|
|
|
|
class BannersControl(TemplateView): |
|
|
|
|
template_name = 'admin/expobanner/banners_control.html' |
|
|
|
|
@ -203,6 +203,8 @@ class PaidStat(DetailView): |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
# ---------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MainList(ListView): |
|
|
|
|
model = Exposition |
|
|
|
|
template_name = 'admin/expobanner/main_list.html' |
|
|
|
|
@ -227,7 +229,6 @@ class MainUpdate(UpdateView): |
|
|
|
|
template_name = 'admin/expobanner/default_form.html' |
|
|
|
|
success_url = '/admin/expobanners/main/list/' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
context = super(MainUpdate, self).get_context_data(**kwargs) |
|
|
|
|
obj = self.object |
|
|
|
|
@ -235,6 +236,50 @@ class MainUpdate(UpdateView): |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MainConfList(ListView): |
|
|
|
|
model = Conference |
|
|
|
|
template_name = 'admin/expobanner/main_list.html' |
|
|
|
|
paginate_by = settings.ADMIN_PAGINATION |
|
|
|
|
|
|
|
|
|
def get_queryset(self): |
|
|
|
|
qs = self.model.objects.language().filter(main__isnull=False).order_by('-main__public') |
|
|
|
|
if self.request.GET.get('onlypublic'): |
|
|
|
|
qs = qs.filter(main__public=True) |
|
|
|
|
return qs |
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
context = super(MainConfList, self).get_context_data(**kwargs) |
|
|
|
|
context.update({'conf': True}) |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from django.core.urlresolvers import reverse_lazy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MainConfCreate(CreateView): |
|
|
|
|
form_class = MainConfCreateForm |
|
|
|
|
template_name = 'admin/expobanner/paid_create.html' |
|
|
|
|
success_url = reverse_lazy('expobanner-conf-list_main') |
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
context = super(MainConfCreate, self).get_context_data(**kwargs) |
|
|
|
|
context.update({'conf': True}) |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MainConfUpdate(UpdateView): |
|
|
|
|
model = MainPage |
|
|
|
|
form_class = MainUpdateForm |
|
|
|
|
template_name = 'admin/expobanner/default_form.html' |
|
|
|
|
success_url = reverse_lazy('expobanner-conf-list_main') |
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
context = super(MainConfUpdate, self).get_context_data(**kwargs) |
|
|
|
|
obj = self.object |
|
|
|
|
context['conference'] = obj.get_event() |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main_turn(request, pk, status): |
|
|
|
|
main = get_object_or_404(MainPage, pk=pk) |
|
|
|
|
if status == 'on': |
|
|
|
|
@ -242,10 +287,11 @@ def main_turn(request, pk, status): |
|
|
|
|
else: |
|
|
|
|
main.public = False |
|
|
|
|
main.save() |
|
|
|
|
return HttpResponseRedirect('/admin/expobanners/main/list/') |
|
|
|
|
return HttpResponseRedirect(request.META['HTTP_REFERER']) |
|
|
|
|
|
|
|
|
|
from datetime import datetime |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MainStat(DetailView): |
|
|
|
|
model = MainPage |
|
|
|
|
template_name = 'admin/expobanner/main_stat.html' |
|
|
|
|
|