remotes/origin/1203
Назар Котюк 11 years ago
parent 499b5a38f1
commit 08a214a6dc
  1. 2
      .gitignore
  2. 4
      article/urls.py
  3. 5
      article/views.py
  4. 3
      conference/forms.py
  5. 62
      conference/urls.py
  6. 15
      conference/views.py
  7. 2
      exposition/models.py
  8. 60
      exposition/urls.py
  9. 27
      exposition/views.py
  10. 6
      import_xls/admin.py
  11. 3
      import_xls/admin_urls.py
  12. 12
      import_xls/export_forms.py
  13. 63
      meta/models.py
  14. 8
      meta/views.py
  15. 4
      proj/production.py
  16. 12
      proj/settings.py
  17. 1
      service/models.py
  18. 2
      templates/client/conference/catalog.html
  19. 2
      templates/client/conference/catalog_theme.html
  20. 2
      templates/client/conference/conference_list.html
  21. 3
      templates/client/exposition/catalog.html
  22. 3
      templates/client/exposition/catalog_theme.html
  23. 2
      templates/client/service/catalog.html
  24. 2
      templates/client/service/participation.html
  25. 2
      templates/client/service/remotely.html
  26. 2
      templates/client/service/tickets.html
  27. 2
      templates/client/service/tour.html
  28. 2
      templates/client/service/translator.html

2
.gitignore vendored

@ -11,5 +11,5 @@ Thumbs.db
npm-debug.log
/proj/local.py
atlassian-ide-plugin.xml

@ -7,6 +7,6 @@ urlpatterns = patterns('',
url(r'blogs/$', BlogList.as_view()),
url(r'news/page/(?P<page>\d+)/$', NewsList.as_view()),
url(r'news/$', NewsList.as_view()),
url(r'blogs/(?P<slug>.*)/$', BlogDetail.as_view()),
url(r'news/(?P<slug>.*)/$', NewsDetail.as_view()),
url(r'blogs/(?P<slug>.*)/$', BlogDetail.as_view(), {'meta_id':19}),
url(r'news/(?P<slug>.*)/$', NewsDetail.as_view(), {'meta_id':19}),
)

@ -4,6 +4,7 @@ from django.http import HttpResponse
from models import Article
from forms import ArticleFilterForm
from theme.models import Tag
from meta.views import MetadataMixin
@ -51,7 +52,7 @@ class NewsList(ListView):
class NewsDetail(DetailView):
class NewsDetail(MetadataMixin, DetailView):
model = Article
slug_field = 'slug'
template_name = 'article/news.html'
@ -102,7 +103,7 @@ class BlogList(ListView):
class BlogDetail(DetailView):
class BlogDetail(MetadataMixin, DetailView):
model = Article
slug_field = 'slug'
template_name = 'article/article.html'

@ -193,7 +193,7 @@ class ConferenceCreateForm(forms.Form):
conference.save()
return conference
"""
def clean(self):
id = self.cleaned_data.get('conference_id')
name_ru = self.cleaned_data.get('name_ru')
@ -205,6 +205,7 @@ class ConferenceCreateForm(forms.Form):
del self.cleaned_data['name_ru']
return self.cleaned_data
"""
def clean_tag(self):
tags = self.cleaned_data.get('tag')

@ -15,39 +15,39 @@ urlpatterns = patterns('',
url(r'conference/search/', ExpositionSearchView.as_view()),
# country catalog
url(r'conference/country/$', ConferenceByCountry.as_view()),
url(r'conference/country/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceCountryCatalog.as_view()),
url(r'conference/country/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceCountryCatalog.as_view()),
url(r'conference/country/(?P<slug>.*)/page/(?P<page>\d+)/$', ConferenceCountryCatalog.as_view()),
url(r'conference/country/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceCountryCatalog.as_view()),
url(r'conference/country/(?P<slug>.*)/(?P<year>\d+)/$', ConferenceCountryCatalog.as_view()),
url(r'conference/country/(?P<slug>.*)/$', ConferenceCountryCatalog.as_view()),
url(r'conference/country/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceCountryCatalog.as_view(), {'meta_id':25}),
url(r'conference/country/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceCountryCatalog.as_view(), {'meta_id':24}),
url(r'conference/country/(?P<slug>.*)/page/(?P<page>\d+)/$', ConferenceCountryCatalog.as_view(), {'meta_id':23}),
url(r'conference/country/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceCountryCatalog.as_view(), {'meta_id':25}),
url(r'conference/country/(?P<slug>.*)/(?P<year>\d+)/$', ConferenceCountryCatalog.as_view(), {'meta_id':24}),
url(r'conference/country/(?P<slug>.*)/$', ConferenceCountryCatalog.as_view(), {'meta_id':23}),
# city catalog
url(r'conference/city/$', ConferenceByCity.as_view()),
url(r'conference/city/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceCityCatalog.as_view()),
url(r'conference/city/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceCityCatalog.as_view()),
url(r'conference/city/(?P<slug>.*)/page/(?P<page>\d+)/$', ConferenceCityCatalog.as_view()),
url(r'conference/city/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceCityCatalog.as_view()),
url(r'conference/city/(?P<slug>.*)/(?P<year>\d+)/$', ConferenceCityCatalog.as_view()),
url(r'conference/city/(?P<slug>.*)/$', ConferenceCityCatalog.as_view()),
url(r'conference/city/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceCityCatalog.as_view(), {'meta_id':28}),
url(r'conference/city/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceCityCatalog.as_view(), {'meta_id':27}),
url(r'conference/city/(?P<slug>.*)/page/(?P<page>\d+)/$', ConferenceCityCatalog.as_view(), {'meta_id':26}),
url(r'conference/city/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceCityCatalog.as_view(), {'meta_id':28}),
url(r'conference/city/(?P<slug>.*)/(?P<year>\d+)/$', ConferenceCityCatalog.as_view(), {'meta_id':27}),
url(r'conference/city/(?P<slug>.*)/$', ConferenceCityCatalog.as_view(), {'meta_id':26}),
# theme catalog
url(r'conference/theme/$', ConferenceByTheme.as_view()),
url(r'conference/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/(?P<year>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/$', ConferenceThemeCatalog.as_view()),
url(r'conference/theme/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view(), {'meta_id':31}),
url(r'conference/theme/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view(), {'meta_id':30}),
url(r'conference/theme/(?P<slug>.*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view(), {'meta_id':29}),
url(r'conference/theme/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceThemeCatalog.as_view(), {'meta_id':31}),
url(r'conference/theme/(?P<slug>.*)/(?P<year>\d+)/$', ConferenceThemeCatalog.as_view(), {'meta_id':30}),
url(r'conference/theme/(?P<slug>.*)/$', ConferenceThemeCatalog.as_view(), {'meta_id':29}),
# tag catalog
url(r'conference/tag/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceTagCatalog.as_view()),
url(r'conference/tag/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceTagCatalog.as_view()),
url(r'conference/tag/(?P<slug>.*)/page/(?P<page>\d+)/$', ConferenceTagCatalog.as_view()),
url(r'conference/tag/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceTagCatalog.as_view()),
url(r'conference/tag/(?P<slug>.*)/(?P<year>\d+)/$', ConferenceTagCatalog.as_view()),
url(r'conference/tag/(?P<slug>.*)/$', ConferenceTagCatalog.as_view()),
url(r'conference/tag/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceTagCatalog.as_view(), {'meta_id':34}),
url(r'conference/tag/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceTagCatalog.as_view(), {'meta_id':33}),
url(r'conference/tag/(?P<slug>.*)/page/(?P<page>\d+)/$', ConferenceTagCatalog.as_view(), {'meta_id':32}),
url(r'conference/tag/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceTagCatalog.as_view(), {'meta_id':34}),
url(r'conference/tag/(?P<slug>.*)/(?P<year>\d+)/$', ConferenceTagCatalog.as_view(), {'meta_id':33}),
url(r'conference/tag/(?P<slug>.*)/$', ConferenceTagCatalog.as_view(), {'meta_id':32}),
# conf additional pages
url(r'conference/(?P<slug>.*)/visitors/page/(?P<page>\d+)/$', ConferenceVisitors.as_view()),
url(r'conference/(?P<slug>.*)/visitors/$', ConferenceVisitors.as_view()),
@ -56,14 +56,14 @@ urlpatterns = patterns('',
url(r'conference/(?P<slug>.*)/service/(?P<service_url>.*)/', ConferenceServiceView.as_view()),
# conf list
url(r'conference/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceList.as_view()),
url(r'conference/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceList.as_view()),
url(r'conference/(?P<year>\d+)/(?P<month>.*)/$', ConferenceList.as_view()),
url(r'conference/(?P<year>\d+)/$', ConferenceList.as_view()),
url(r'conference/page/(?P<page>\d+)/$', ConferenceList.as_view()),
url(r'conference/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceList.as_view(), {'meta_id':22}),
url(r'conference/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceList.as_view(), {'meta_id':21}),
url(r'conference/(?P<year>\d+)/(?P<month>.*)/$', ConferenceList.as_view(), {'meta_id':22}),
url(r'conference/(?P<year>\d+)/$', ConferenceList.as_view(), {'meta_id':21}),
url(r'conference/page/(?P<page>\d+)/$', ConferenceList.as_view(), {'meta_id':20}),
# conf page
url(r'conference/(?P<slug>.*)/$', ConferenceDetail.as_view()),
url(r'conference/$', ConferenceList.as_view()),
url(r'conference/(?P<slug>.*)/$', ConferenceDetail.as_view(), {'meta_id':35}),
url(r'conference/$', ConferenceList.as_view(), {'meta_id':20}),
)

@ -18,6 +18,7 @@ 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
MONTHES = settings.MONTHES
@ -75,7 +76,7 @@ class ConferenceByCity(ConferenceBy):
.order_by('translations__name').distinct()
class ConferenceCatalog(ListView):
class ConferenceCatalog(MetadataMixin, ListView):
model = Conference
paginate_by = settings.CLIENT_PAGINATION
template_name = 'client/conference/catalog.html'
@ -145,6 +146,7 @@ class ConferenceCountryCatalog(ConferenceCatalog):
#this method used in parent get_queryset
slug = self.kwargs.get('slug')
country = get_object_or_404(Country, url=slug)
self.kwargs['country'] = country
self.filter_object = country
qs = self.model.enable.filter(country=country)
return qs
@ -155,6 +157,7 @@ class ConferenceCityCatalog(ConferenceCatalog):
#this method used in parent get_queryset
slug = self.kwargs.get('slug')
city = get_object_or_404(City, url=slug)
self.kwargs['city'] = city
qs = self.model.enable.filter(city=city)
self.filter_object = city
return qs
@ -172,6 +175,7 @@ class ConferenceThemeCatalog(ConferenceCatalog):
country_slug = self.kwargs.get('country_slug')
city_slug = self.kwargs.get('city_slug')
theme = get_object_or_404(Theme, url=slug)
self.kwargs['theme'] = theme
qs = self.model.enable.filter(theme=theme)
if country_slug:
@ -202,12 +206,13 @@ class ConferenceTagCatalog(ConferenceCatalog):
#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.filter(tag=tag)
self.filter_object = tag
return qs
class ConferenceVisitors(ListView):
class ConferenceVisitors(MetadataMixin, ListView):
paginate_by = settings.CLIENT_PAGINATION
model = Conference
#template_name = 'event_visitors.html'
@ -230,7 +235,7 @@ class ConferenceVisitors(ListView):
return context
class ConferenceMembers(ListView):
class ConferenceMembers(MetadataMixin, ListView):
paginate_by = settings.CLIENT_PAGINATION
model = Conference
#template_name = 'event_visitors.html'
@ -315,7 +320,7 @@ class ConferenceServiceView(FormMixin, DetailView):
class ConferenceDetail(DetailView):
class ConferenceDetail(MetadataMixin, DetailView):
model = Conference
slug_field = 'url'
template_name = 'client/conference/conference_detail.html'
@ -325,7 +330,7 @@ class ConferenceDetail(DetailView):
context['advertising_form'] = AdvertiseForm()
return context
class ConferenceList(ListView):
class ConferenceList(MetadataMixin, ListView):
model = Conference
paginate_by = settings.CLIENT_PAGINATION
template_name = 'client/conference/conference_list.html'

@ -247,7 +247,7 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
if self.theme.all():
theme = self.theme.all()[0]
now = datetime.datetime.now()
now = now.replace(day=now.day-1)
now = now - datetime.timedelta(days=1)
expositions = Exposition.objects.filter(theme__in=[theme], data_begin__gt=now).exclude(id=self.id).order_by('data_begin')
return expositions[:3]
else:

@ -17,45 +17,43 @@ urlpatterns = patterns('',
# search
url(r'expo/search/', ExpositionSearchView.as_view()),
# country catalog
url(r'expo/country/$', ExpositionByCountry.as_view()),
url(r'expo/country/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoCountryCatalog.as_view()),
url(r'expo/country/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoCountryCatalog.as_view()),
url(r'expo/country/(?P<slug>.*)/page/(?P<page>\d+)/$', ExpoCountryCatalog.as_view()),
url(r'expo/country/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoCountryCatalog.as_view()),
url(r'expo/country/(?P<slug>.*)/(?P<year>\d+)/$', ExpoCountryCatalog.as_view()),
url(r'expo/country/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoCountryCatalog.as_view(), {'meta_id':7}),
url(r'expo/country/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoCountryCatalog.as_view(), {'meta_id':6}),
url(r'expo/country/(?P<slug>.*)/page/(?P<page>\d+)/$', ExpoCountryCatalog.as_view(), {'meta_id':5}),
url(r'expo/country/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoCountryCatalog.as_view(), {'meta_id':7}),
url(r'expo/country/(?P<slug>.*)/(?P<year>\d+)/$', ExpoCountryCatalog.as_view(), {'meta_id':6}),
url(r'expo/country/(?P<slug>.*)/$', ExpoCountryCatalog.as_view(), {'meta_id':5}),
# city catalog
url(r'expo/city/$', ExpositionByCity.as_view()),
url(r'expo/city/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoCityCatalog.as_view()),
url(r'expo/city/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoCityCatalog.as_view()),
url(r'expo/city/(?P<slug>.*)/page/(?P<page>\d+)/$', ExpoCityCatalog.as_view()),
url(r'expo/city/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoCityCatalog.as_view()),
url(r'expo/city/(?P<slug>.*)/(?P<year>\d+)/$', ExpoCityCatalog.as_view()),
url(r'expo/city/(?P<slug>.*)/$', ExpoCityCatalog.as_view()),
url(r'expo/city/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoCityCatalog.as_view(), {'meta_id':10}),
url(r'expo/city/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoCityCatalog.as_view(), {'meta_id':9}),
url(r'expo/city/(?P<slug>.*)/page/(?P<page>\d+)/$', ExpoCityCatalog.as_view(), {'meta_id':8}),
url(r'expo/city/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoCityCatalog.as_view(), {'meta_id':10}),
url(r'expo/city/(?P<slug>.*)/(?P<year>\d+)/$', ExpoCityCatalog.as_view(), {'meta_id':9}),
url(r'expo/city/(?P<slug>.*)/$', ExpoCityCatalog.as_view(), {'meta_id':8}),
# theme catalog
url(r'expo/theme/$', ExpositionByTheme.as_view()),
url(r'expo/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/(?P<year>\d+)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/$', ExpoThemeCatalog.as_view()),
url(r'expo/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':44}),
url(r'expo/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/$', ExpoThemeCatalog.as_view(), {'meta_id':44}),
url(r'expo/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
url(r'expo/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
url(r'expo/theme/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':13}),
url(r'expo/theme/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':12}),
url(r'expo/theme/(?P<slug>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':11}),
url(r'expo/theme/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoThemeCatalog.as_view(), {'meta_id':13}),
url(r'expo/theme/(?P<slug>.*)/(?P<year>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':12}),
url(r'expo/theme/(?P<slug>.*)/$', ExpoThemeCatalog.as_view(), {'meta_id':11}),
# tag catalog
url(r'expo/tag/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoTagCatalog.as_view()),
url(r'expo/tag/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoTagCatalog.as_view()),
url(r'expo/tag/(?P<slug>.*)/page/(?P<page>\d+)/$', ExpoTagCatalog.as_view()),
url(r'expo/tag/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoTagCatalog.as_view()),
url(r'expo/tag/(?P<slug>.*)/(?P<year>\d+)/$', ExpoTagCatalog.as_view()),
url(r'expo/tag/(?P<slug>.*)/$', ExpoTagCatalog.as_view()),
url(r'expo/tag/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoTagCatalog.as_view(), {'meta_id':17}),
url(r'expo/tag/(?P<slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoTagCatalog.as_view(), {'meta_id':15}),
url(r'expo/tag/(?P<slug>.*)/page/(?P<page>\d+)/$', ExpoTagCatalog.as_view(), {'meta_id':14}),
url(r'expo/tag/(?P<slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoTagCatalog.as_view(), {'meta_id':17}),
url(r'expo/tag/(?P<slug>.*)/(?P<year>\d+)/$', ExpoTagCatalog.as_view(), {'meta_id':15}),
url(r'expo/tag/(?P<slug>.*)/$', ExpoTagCatalog.as_view(), {'meta_id':14}),
# expo additional pages
url(r'expo/(?P<slug>.*)/statistic/$', ExpositionStatistic.as_view()),
url(r'expo/(?P<slug>.*)/price/$', ExpositionPrice.as_view()),
@ -73,7 +71,7 @@ urlpatterns = patterns('',
url(r'expo/(?P<year>\d+)/$', ExpoList.as_view(), {'meta_id':3}),
url(r'expo/page/(?P<page>\d+)/$', ExpoList.as_view(), {'meta_id':2}),
# expo page
url(r'expo/(?P<slug>.*)/$', ExpoDetail.as_view()),# event
url(r'expo/(?P<slug>.*)/$', ExpoDetail.as_view(), {'meta_id':18}),# event
url(r'expo/$', ExpoList.as_view(), {'meta_id':2}),

@ -128,7 +128,7 @@ def exposition_visit(request, id):
#------------------------------------------------------------------------------
class ExpoDetail(DetailView):
class ExpoDetail(MetadataMixin, DetailView):
model = Exposition
slug_field = 'url'
template_name = 'client/exposition/exposition_detail.html'
@ -157,11 +157,18 @@ class ExpositionStatistic(DetailView):
template_name = 'client/exposition/statistic.html'
from django.views.generic.edit import FormMixin, ModelFormMixin
class ExpositionServiceView(FormMixin, DetailView):
class ExpositionServiceView(MetadataMixin, FormMixin, DetailView):
model = Exposition
slug_field = 'url'
service = None
def dispatch(self, request, *args, **kwargs):
service_url = self.kwargs.get('service_url')
service = get_object_or_404(Service, url=service_url)
self.service = service
self.template_name = service.template
return super(ExpositionServiceView, self).dispatch(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
self.object = self.get_object()
service_url = self.kwargs.get('service_url')
@ -176,17 +183,16 @@ class ExpositionServiceView(FormMixin, DetailView):
return self.form_invalid(form)
def get_context_data(self, **kwargs):
kwargs.update({'meta_id': getattr(self.service, 'meta_id','')})
context = super(ExpositionServiceView, self).get_context_data(**kwargs)
service_url = self.kwargs.get('service_url')
service = get_object_or_404(Service, url=service_url)
self.service = service
self.template_name = service.template
form = order_forms.get(service_url)
self.form_class = form
if not form:
raise Http404
context['form'] = self.get_form(self.form_class)
context['service'] = service
context['service'] = self.service
context['object'] = self.get_object()
return context
@ -257,7 +263,7 @@ class ExpoList(MetadataMixin, ListView):
MONTHES = settings.MONTHES
class ExpoCatalog(ListView):
class ExpoCatalog(MetadataMixin, ListView):
model = Exposition
paginate_by = settings.CLIENT_PAGINATION
template_name = 'exposition/catalog.html'
@ -321,7 +327,7 @@ class ExpoCatalog(ListView):
context['catalog_url'] = self.catalog_url
return context
class ExpoCountryCatalog(MetadataMixin, ExpoCatalog):
class ExpoCountryCatalog(ExpoCatalog):
catalog_url = '/expo/country/'
def get_filtered_qs(self):
#this method used in parent get_queryset
@ -338,6 +344,7 @@ class ExpoCityCatalog(ExpoCatalog):
#this method used in parent get_queryset
slug = self.kwargs.get('slug')
city = get_object_or_404(City, url=slug)
self.kwargs['city'] = city
qs = self.model.enable.filter(city=city)
self.filter_object = city
return qs
@ -355,16 +362,19 @@ class ExpoThemeCatalog(ExpoCatalog):
country_slug = self.kwargs.get('country_slug')
city_slug = self.kwargs.get('city_slug')
theme = get_object_or_404(Theme, url=slug)
self.kwargs['theme'] = theme
qs = self.model.enable.filter(theme=theme)
if country_slug:
country = get_object_or_404(Country, url=country_slug)
self.country = country
self.kwargs['country'] = country
qs = qs.filter(country=country)
if city_slug:
city = get_object_or_404(City, url=city_slug)
self.city = city
self.kwargs['city'] = city
qs = qs.filter(city=city)
self.filter_object = theme
@ -385,6 +395,7 @@ class ExpoTagCatalog(ExpoCatalog):
#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.filter(tag=tag)
self.filter_object = tag
return qs

@ -11,7 +11,7 @@ import xlrd
from import_forms import ImportEventForm, ImportThemeForm, ImportTagForm, ImportOrganiserForm,\
ImportPlaceConferenceForm, ImportPlaceExpositionForm
from export_forms import ExportEventForm, ExportOrganiserForm, ExportThemeForm, ExportTagForm,\
ExportUserForm, ExportCompanyForm, ExportPlaceConferenceForm, ExportPlaceExpositionForm
ExportUserForm, ExportCompanyForm, ExportPlaceConferenceForm, ExportPlaceExpositionForm, ExportBlogForm
from django.views.generic import FormView
from django.contrib import messages
@ -78,6 +78,10 @@ class ExportPlaceExposition(ExportView):
form_class = ExportPlaceExpositionForm
success_url = '/admin/export-place_exposition'
class ExportBlog(ExportView):
form_class = ExportBlogForm
success_url = '/admin/export-blog/'
from exposition.models import Exposition

@ -3,7 +3,7 @@ from django.conf.urls import patterns, url
from admin import ImportTheme, ImportEvent, ImportOrganiser, ImportTag, ImportPlaceExposition, ImportPlaceConference
from admin import ExportTheme, ExportEvent, ExportOrganiser, ExportTag, ExportPlaceExposition,\
ExportPlaceConference, ExportCompany, ExportUser
ExportPlaceConference, ExportCompany, ExportUser, ExportBlog
urlpatterns = patterns('',
url(r'^import-event/$', ImportEvent.as_view()),
@ -21,5 +21,6 @@ urlpatterns = patterns('',
url(r'^export-place_conference/$', ExportPlaceConference.as_view()),
url(r'^export-user/$', ExportUser.as_view()),
url(r'^export-company/$', ExportCompany.as_view()),
url(r'^export-blog/$', ExportBlog.as_view()),
)

@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from django.utils import translation
from theme.models import Theme, Tag
from country.models import Country
from organiser.models import Organiser
from accounts.models import User
from company.models import Company
from article.models import Article
from place_exposition.models import PlaceExposition
from place_conference.models import PlaceConference
from django.db.models.loading import get_model
@ -149,6 +151,16 @@ class ExportCompanyForm(ExportForm):
def get_fname(self):
return 'companies.xls'
class ExportBlogForm(ExportForm):
model = Article
def get_fname(self):
return 'blogs.xls'
def get_objects(self, data):
translation.activate(data['language'])
return self.model.objects.blogs()
class ExportEventForm(forms.Form):

@ -7,6 +7,39 @@ from hvad.models import TranslatableModel, TranslatedFields, TranslationManager
from pymorphy.django_conf import default_morph as morph
from functions.signal_handlers import post_save_handler
# additional funcs
MONTHES = {'jan': _(u'январе'), 'feb': _(u'феврале'), 'mar': _(u'марте'), 'apr': _(u'апреле'),
'may': _(u'мае'), 'jun': _(u'июне'), u'jul': _(u'июле'), 'aug': _(u'августе'),
'sep': _(u'сентябре'), 'oct': _(u'октябре'), 'nov': _(u'ноябре'), 'dec': _(u'декабре'),}
def get_month_inflect(value, key):
return {key: MONTHES.get(value, '') }
def get_obj_inflect(obj, key):
if translation.get_language() == 'ru':
result = {key: getattr(obj, 'inflect', '')}
else:
result = {key: getattr(obj, 'name', '')}
return result
def get_theme_inflect(obj, key):
if translation.get_language() == 'ru':
result = {'theme_inflect': getattr(obj, 'inflect', ''),
'theme_name': getattr(obj, 'name', '')}
else:
result = {'theme_inflect': getattr(obj, 'name', ''),
'theme_name': getattr(obj, 'name', '')}
return result
def get_tag_inflect(obj, key):
if translation.get_language() == 'ru':
result = {'tag_inflect': getattr(obj, 'inflect', ''),
'tag_name': getattr(obj, 'name', '')}
else:
result = {'tag_inflect': getattr(obj, 'name', ''),
'tag_name': getattr(obj, 'name', '')}
return result
class MetaSetting(TranslatableModel):
name = models.CharField(max_length=100, unique=True)
translations = TranslatedFields(
@ -16,36 +49,34 @@ class MetaSetting(TranslatableModel):
h1 = models.CharField(max_length=255, blank=True),
)
object_params = {'EXPONAME':{'name': 'name'},
'EXPONAME_YA':{'name': 'name', 'inflect': True},
'EXPOCOUNTRY':{'name': 'country'},
'EXPOCOUNTRY_YA':{'name': 'country', 'inflect': True},
'EXPOPLACE':{'name': 'place'},
'EXPOCITY':{'name': 'city'},
'EXPOTHEME':{'name': 'theme'},
'EXPOTAG':{'name': 'tag'},
'EXPOMONTH':{'name': 'month'},
'EXPOYEAR':{'name': 'year'},
}
params = {}
object_params = {'object_name': 'name', 'object_title': 'main_title'}
params = {'month': get_month_inflect, 'country': get_obj_inflect, 'city': get_obj_inflect,
'theme': get_theme_inflect, 'tag': get_tag_inflect}
monthes = {'jan': _(u'январе'), 'feb': _(u'феврале'), 'mar': _(u'марте'), 'apr': _(u'апреле'),
'may': _(u'мае'), 'jun': _(u'июне'), u'jul': _(u'июле'), 'aug': _(u'августе'),
'sep': _(u'сентябре'), 'oct': _(u'октябре'), 'nov': _(u'ноябре'), 'dec': _(u'декабре'),}
def __unicode__(self):
return self.name
def generate_meta(self, params, obj=None):
"""
obj must be in current language
"""
lang = translation.get_language()
updates = {}
if obj:
params.update({'EXPONAME': getattr(obj, 'name', '')})
for key, value in self.object_params.iteritems():
updates.update({key: getattr(obj, value, '')})
if params.get('month'):
month = params['month']
params['month'] = self.monthes[month]
for key, value in params.iteritems():
if key in self.params:
updates.update(self.params[key](value, key))
params.update(updates)
tr = self.translations.get(language_code=lang)
title = tr.title.format(**params)

@ -155,13 +155,19 @@ class MetadataMixin(object):
context = super(MetadataMixin, self).get_context_data(**kwargs)
meta_id = self.kwargs.get('meta_id')
if not meta_id:
meta_id = kwargs.get('meta_id')
if meta_id:
try:
meta_set = MetaSetting.objects.get(id=meta_id)
except MetaSetting.DoesNotExist:
return context
params = dict(self.kwargs)
data = meta_set.generate_meta(params)
if getattr(self, 'object', None):
data = meta_set.generate_meta(params, self.object)
else:
data = meta_set.generate_meta(params)
self.title = data.get('title')
self.h1 = data.get('h1')

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# Django local settings
DEBUG = True # изменить когда будет продакшн
DEBUG = False
ALLOWED_HOSTS = ['hit.expomap.ru', '195.66.79.152', '195.66.79.145', 'expomap.ru']
DATABASES = {
'default': {

@ -385,12 +385,7 @@ CALLBACK_EMAIL = 'kotzilla@ukr.net'
BOOKING_AID = '333667'
"""
try:
from local import *
except ImportError, e:
from production import *
"""
ADMIN_PAGINATION = 20
CLIENT_PAGINATION = 15
TEMPLATE_DEBUG = DEBUG
@ -407,3 +402,8 @@ MONTHES = {'jan': {'value': 1, 'name': _(u'Январь')}, 'feb': {'value': 2,
'jul': {'value': 7, 'name': _(u'Июль')}, 'aug': {'value': 8, 'name': _(u'Август')},
'sep': {'value': 9, 'name': _(u'Сентябрь')}, 'oct': {'value': 10, 'name': _(u'Октябрь')},
'nov': {'value': 11, 'name': _(u'Ноябрь')}, 'dec': {'value': 12, 'name': _(u'Декабрь')}}
try:
from local import *
except ImportError, e:
pass

@ -31,6 +31,7 @@ class Service(TranslatableModel):
)
sort = models.PositiveIntegerField(default=0, db_index=True)
main_page = models.PositiveIntegerField(default=0, db_index=True)
meta_id = models.IntegerField(null=True)
def __unicode__(self):

@ -24,7 +24,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Конференции' %}: <strong>{{ filter_object.name }}</strong></h1>
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Конференции' %}: <strong>{{ filter_object.name }}</strong>{% endif %}</h1>
</div>
{% include 'includes/exposition/catalog_filter_period.html' %}

@ -49,7 +49,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Конференции' %}: <strong>{{ filter_object.name }}</strong></h1>
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Конференции' %}: <strong>{{ filter_object.name }}</strong>{% endif %}</h1>
</div>
{% include 'includes/exposition/catalog_filter_period.html' %}

@ -23,7 +23,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Конференции' %}</h1>
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Конференции' %}{% endif %}</h1>
</div>
{% include 'includes/exposition/catalog_filter_period.html' %}

@ -24,7 +24,8 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Выставки' %}: <strong>{{ filter_object.name }}</strong></h1>
{# <h1>{% trans 'Выставки' %}: <strong>{{ filter_object.name }}</strong></h1> #}
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Выставки' %}: <strong>{{ filter_object.name }}</strong>{% endif %}</h1>
</div>
{% include 'includes/exposition/catalog_filter_period.html' %}

@ -49,7 +49,8 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Выставки' %}: <strong>{{ filter_object.name }}</strong></h1>
{# <h1>{% trans 'Выставки' %}: <strong>{{ filter_object.name }}</strong></h1> #}
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Выставки' %}: <strong>{{ filter_object.name }}</strong>{% endif %}</h1>
</div>
{% include 'includes/exposition/catalog_filter_period.html' %}

@ -22,7 +22,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Официальный каталог выставки' %}{% if object %} {{ object.name }} {% endif %}</h1>
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Официальный каталог выставки' %}{% if object %} {{ object.name }} {% endif %}{% endif %}</h1>
</div>
{% endblock %}

@ -21,7 +21,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Участие в выставке' %}{% if object %} {{ object.name }} {% endif %}</h1>
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Участие в выставке' %}{% if object %} {{ object.name }} {% endif %}{% endif %}</h1>
</div>
{% endblock %}

@ -23,7 +23,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Заочное посещение выставки' %}{% if object %} {{ object.name }} {% endif %}</h1>
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Заочное посещение выставки' %}{% if object %} {{ object.name }} {% endif %}{% endif %}</h1>
</div>
{% endblock %}

@ -22,7 +22,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Билеты на выставку' %}{% if object %} {{ object.name }} {% endif %}</h1>
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Билеты на выставку' %}{% if object %} {{ object.name }} {% endif %}{% endif %}</h1>
</div>
{% endblock %}

@ -22,7 +22,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Посещение выставки' %} {% if object %}{{ object.name }}{% endif %}</h1>
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Посещение выставки' %} {% if object %}{{ object.name }}{% endif %}{% endif %}</h1>
</div>
{% endblock %}

@ -23,7 +23,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Услуги переводчика' %}{% if object %} {% trans 'на' %} {{ object.name }} {% endif %}</h1>
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Услуги переводчика' %}{% if object %} {% trans 'на' %} {{ object.name }} {% endif %}{% endif %}</h1>
</div>
{% endblock %}

Loading…
Cancel
Save