Merge branch 'develop' of git.general-servers.com:expomap/expomap into develop

remotes/origin/1203
pavel 11 years ago
commit 50f7e784a7
  1. 15
      article/admin.py
  2. 32
      article/forms.py
  3. 2
      article/models.py
  4. 2
      banners/models.py
  5. 3
      conference/urls.py
  6. 8
      conference/views.py
  7. 6
      exposition/models.py
  8. 3
      exposition/urls.py
  9. 9
      exposition/views.py
  10. 9
      service/admin_urls.py
  11. 4
      service/order_forms.py
  12. 7
      service/urls.py
  13. 41
      service/views.py
  14. 2
      settings/conference_old_urls.py
  15. 14
      settings/old_urls.py
  16. 12
      settings/redirect_views.py
  17. 65
      templates/admin/article/blog_form.html
  18. 5
      templates/client/article/article.html
  19. 5
      templates/client/article/news.html
  20. 4
      templates/client/base_catalog.html
  21. 4
      templates/client/exposition/exposition_detail.html
  22. 4
      templates/client/includes/exposition/expo_paid.html
  23. 2
      templates/client/includes/exposition/exposition_object.html
  24. 11
      templates/client/includes/exposition/price.html
  25. 6
      templates/client/includes/exposition/services.html
  26. 6
      templates/client/service/remotely.html
  27. 26
      templates/client/service/thank_u_page.html
  28. 2
      templates/client/service/translator.html
  29. 48
      theme/management/commands/tag_translate.py

@ -156,8 +156,12 @@ class BlogView(FormView):
article = self.obj article = self.obj
data = {} data = {}
data['theme'] = [item.id for item in article.theme.all()] data['theme'] = [item.id for item in article.theme.all()]
data['exposition'] = article.exposition if article.exposition:
data['conference'] = article.conference data['exposition'] = article.exposition.id
if article.conference:
data['conference'] = article.conference.id
data['publish_date'] = article.publish_date
a = ','.join(['%s:%s'%(item.id, item.name) for item in article.tag.all()]) a = ','.join(['%s:%s'%(item.id, item.name) for item in article.tag.all()])
data['tag'] = ','.join(['%s:%s'%(item.id, item.name) for item in article.tag.all()]) data['tag'] = ','.join(['%s:%s'%(item.id, item.name) for item in article.tag.all()])
@ -171,7 +175,12 @@ class BlogView(FormView):
data['descriptions_%s' % code] = obj.descriptions data['descriptions_%s' % code] = obj.descriptions
form = form_class(data) form = form_class(data)
#form.fields['tag'].widget.attrs['data-init-text'] = [item.name for item in article.tag.all()] #form.fields['tag'].widget.attrs['data-init-text'] = [item.name for item in article.tag.all()]
return form_class(data) if article.exposition:
form.fields['exposition'].widget.attrs['data-init-text'] = article.exposition.name
if article.conference:
form.fields['conference'].widget.attrs['data-init-text'] = article.conference.name
return form
else: else:
return form_class() return form_class()

@ -21,6 +21,7 @@ class BlogForm(forms.Form):
type = Article.blog type = Article.blog
theme = forms.ModelMultipleChoiceField(label='Тематики', queryset=Theme.objects.all(), required=False, theme = forms.ModelMultipleChoiceField(label='Тематики', queryset=Theme.objects.all(), required=False,
widget=forms.SelectMultiple(attrs={'style':'width: 550px'})) widget=forms.SelectMultiple(attrs={'style':'width: 550px'}))
publish_date = forms.DateField(label=u'Дата публикации', input_formats=['%Y-%m-%d', '%d.%m.%Y'], required=False)
tag = forms.CharField(label=u'Теги', widget=forms.HiddenInput(), required=False) tag = forms.CharField(label=u'Теги', widget=forms.HiddenInput(), required=False)
logo = forms.ImageField(label=u'Лого', required=False) logo = forms.ImageField(label=u'Лого', required=False)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -51,10 +52,12 @@ class BlogForm(forms.Form):
#create new Article object or get exists #create new Article object or get exists
if not article: if not article:
article = Article() article = Article()
article.author = author
article.author = author
article.type = self.type article.type = self.type
article.logo = data['logo'] if data['logo']:
article.logo = data['logo']
article.publish_date = data['publish_date']
# fill translated fields and save object # fill translated fields and save object
fill_with_signal(Article, article, data) fill_with_signal(Article, article, data)
# fill manytomany fields # fill manytomany fields
@ -87,8 +90,11 @@ class BlogForm(forms.Form):
class NewsForm(BlogForm): class NewsForm(BlogForm):
type = Article.news type = Article.news
exposition = forms.ModelChoiceField(label = u'Выставка', required=False, queryset=Exposition.objects.all()) exposition = forms.CharField(label=u'Выставка', widget=forms.HiddenInput(), required=False)
conference = forms.ModelChoiceField(label = u'Конференция', required=False, queryset=Conference.objects.all()) conference = forms.CharField(label=u'Конференция', widget=forms.HiddenInput(), required=False)
#exposition = forms.ModelChoiceField(label = u'Выставка', required=False, queryset=Exposition.objects.all())
#conference = forms.ModelChoiceField(label = u'Конференция', required=False, queryset=Conference.objects.all())
def save(self, author, article=None): def save(self, author, article=None):
article = super(NewsForm, self).save(author, article) article = super(NewsForm, self).save(author, article)
@ -99,6 +105,24 @@ class NewsForm(BlogForm):
article.save() article.save()
return article return article
def clean_exposition(self):
id = self.cleaned_data['exposition']
if not id:
return None
try:
return Exposition.objects.get(id=id)
except Exposition.DoesNotExist:
return None
def clean_conference(self):
id = self.cleaned_data['conference']
if not id:
return None
try:
return Conference.objects.get(id=id)
except Conference.DoesNotExist:
return None
class ArticleForm(forms.Form): class ArticleForm(forms.Form):
""" """
Create Article form for creating conference Create Article form for creating conference

@ -106,7 +106,7 @@ class Article(TranslatableModel):
"set a custom description."), default=False) "set a custom description."), default=False)
# published = models. # published = models.
created = models.DateTimeField() created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True)
#translated fields #translated fields

@ -10,4 +10,4 @@ class Redirect(models.Model):
return self.redirect return self.redirect
def get_object_url(self): def get_object_url(self):
return '/redirect/reditect/%d/'%self.id return '/redirect/redirect/%d/'%self.id

@ -2,7 +2,7 @@
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from views import ConferenceDetail, ConferenceList, ConferenceByCity, ConferenceByCountry, ConferenceByTheme,\ from views import ConferenceDetail, ConferenceList, ConferenceByCity, ConferenceByCountry, ConferenceByTheme,\
ConferenceCountryCatalog, ConferenceCityCatalog, ConferenceTagCatalog, ConferenceThemeCatalog, ConferenceMembers,\ ConferenceCountryCatalog, ConferenceCityCatalog, ConferenceTagCatalog, ConferenceThemeCatalog, ConferenceMembers,\
ConferenceVisitors, ConferenceServiceView ConferenceVisitors, ConferenceServiceView, ConferenceThankView
from exposition.views import ExpositionSearchView from exposition.views import ExpositionSearchView
urlpatterns = patterns('', urlpatterns = patterns('',
@ -53,6 +53,7 @@ urlpatterns = patterns('',
url(r'conference/(?P<slug>.*)/visitors/$', ConferenceVisitors.as_view()), url(r'conference/(?P<slug>.*)/visitors/$', ConferenceVisitors.as_view()),
url(r'conference/(?P<slug>.*)/members/page/(?P<page>\d+)/$', ConferenceMembers.as_view()), url(r'conference/(?P<slug>.*)/members/page/(?P<page>\d+)/$', ConferenceMembers.as_view()),
url(r'conference/(?P<slug>.*)/members/$', ConferenceMembers.as_view()), url(r'conference/(?P<slug>.*)/members/$', ConferenceMembers.as_view()),
url(r'^conference/(?P<slug>.*)/service/thanks/', ConferenceThankView.as_view()),
url(r'conference/(?P<slug>.*)/service/(?P<service_url>.*)/', ConferenceServiceView.as_view()), url(r'conference/(?P<slug>.*)/service/(?P<service_url>.*)/', ConferenceServiceView.as_view()),
# conf list # conf list

@ -271,6 +271,12 @@ class ConferenceMembers(MetadataMixin, ListView):
from service.models import Service from service.models import Service
from service.views import order_forms from service.views import order_forms
class ConferenceThankView(MetadataMixin, DetailView):
model = Conference
slug_field = 'url'
template_name = 'client/service/thank_u_page.html'
class ConferenceServiceView(FormMixin, DetailView): class ConferenceServiceView(FormMixin, DetailView):
model = Conference model = Conference
slug_field = 'url' slug_field = 'url'
@ -310,7 +316,7 @@ class ConferenceServiceView(FormMixin, DetailView):
order.conference = self.object order.conference = self.object
order.save() order.save()
messages.success(self.request, _(u'Ваш запрос был успешно отправлен')) messages.success(self.request, _(u'Ваш запрос был успешно отправлен'))
return HttpResponseRedirect(self.success_url) return HttpResponseRedirect(self.object.get_permanent_url()+'service/thanks/')
def get_initial(self): def get_initial(self):
""" """

@ -365,9 +365,9 @@ def logo_name(instance, filename):
class Paid(models.Model): class Paid(models.Model):
expo = models.OneToOneField(Exposition) expo = models.OneToOneField(Exposition)
org_logo = models.ImageField(upload_to=logo_name, blank=True, max_length=255) org_logo = models.ImageField(upload_to=logo_name, blank=True, max_length=255)
oficial_link = models.ForeignKey('banners.Redirect', null=True, blank=True) oficial_link = models.ForeignKey('banners.Redirect', null=True, blank=True, related_name='expo_oficial')
participation_link = models.ForeignKey('banners.Redirect', null=True, blank=True) participation_link = models.ForeignKey('banners.Redirect', null=True, blank=True, related_name='expo_participation')
tickets_link = models.ForeignKey('banners.Redirect', null=True, blank=True) tickets_link = models.ForeignKey('banners.Redirect', null=True, blank=True, related_name='expo_tickets')
pre_save.connect(pre_save_handler, sender=Exposition) pre_save.connect(pre_save_handler, sender=Exposition)

@ -7,7 +7,7 @@ from views import ExpositionStatistic, ExpositionPrice,\
from django.views.decorators.cache import cache_page from django.views.decorators.cache import cache_page
from views import ExpositionServiceView from views import ExpositionServiceView
from views import ExpoCountryCatalog, ExpoCityCatalog, ExpoThemeCatalog, ExpoTagCatalog, ExpoList, ExpoDetail,\ from views import ExpoCountryCatalog, ExpoCityCatalog, ExpoThemeCatalog, ExpoTagCatalog, ExpoList, ExpoDetail,\
ExpoVisitors, ExpoMembers ExpoVisitors, ExpoMembers, ExpositionThankView
urlpatterns = patterns('', urlpatterns = patterns('',
@ -70,6 +70,7 @@ urlpatterns = patterns('',
url(r'^expo/(?P<slug>.*)/visitors/$', ExpoVisitors.as_view(), {'meta_id':64}), url(r'^expo/(?P<slug>.*)/visitors/$', ExpoVisitors.as_view(), {'meta_id':64}),
url(r'^expo/(?P<slug>.*)/members/page/(?P<page>\d+)/$', ExpoMembers.as_view(), {'meta_id':63}), url(r'^expo/(?P<slug>.*)/members/page/(?P<page>\d+)/$', ExpoMembers.as_view(), {'meta_id':63}),
url(r'^expo/(?P<slug>.*)/members/$', ExpoMembers.as_view(), {'meta_id':63}), url(r'^expo/(?P<slug>.*)/members/$', ExpoMembers.as_view(), {'meta_id':63}),
url(r'^expo/(?P<slug>.*)/service/thanks/', ExpositionThankView.as_view()),
url(r'^expo/(?P<slug>.*)/service/(?P<service_url>.*)/', ExpositionServiceView.as_view()), url(r'^expo/(?P<slug>.*)/service/(?P<service_url>.*)/', ExpositionServiceView.as_view()),
# expo list # expo list
url(r'^expo/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoList.as_view(), {'meta_id':4}), url(r'^expo/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoList.as_view(), {'meta_id':4}),

@ -165,6 +165,12 @@ class ExpositionStatistic(MetadataMixin, DetailView):
template_name = 'client/exposition/statistic.html' template_name = 'client/exposition/statistic.html'
from django.views.generic.edit import FormMixin, ModelFormMixin 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'
class ExpositionServiceView(MetadataMixin, FormMixin, DetailView): class ExpositionServiceView(MetadataMixin, FormMixin, DetailView):
model = Exposition model = Exposition
slug_field = 'url' slug_field = 'url'
@ -209,8 +215,7 @@ class ExpositionServiceView(MetadataMixin, FormMixin, DetailView):
order = form.save(commit=False) order = form.save(commit=False)
order.exposition = self.object order.exposition = self.object
order.save() order.save()
messages.success(self.request, _(u'Ваш запрос был успешно отправлен')) return HttpResponseRedirect(self.object.get_permanent_url()+'service/thanks/')
return HttpResponseRedirect(self.success_url)
def get_initial(self): def get_initial(self):
""" """

@ -1,11 +1,20 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from views import CallBackListView, VisitListView, TranslationListView, AdvertisingListView, \
ParticipationListView, RemoteListView,TicketsListView
urlpatterns = patterns('service.admin', urlpatterns = patterns('service.admin',
url(r'^add.*/$', 'service_add'), url(r'^add.*/$', 'service_add'),
url(r'^delete/(?P<url>.*)/$', 'service_delete'), url(r'^delete/(?P<url>.*)/$', 'service_delete'),
url(r'^change/(?P<url>.*)/$', 'service_change'), url(r'^change/(?P<url>.*)/$', 'service_change'),
url(r'^all/$', 'service_all'), url(r'^all/$', 'service_all'),
url(r'order/callback/$', CallBackListView.as_view()),
url(r'order/visit/$', VisitListView.as_view()),
url(r'order/translation/$', TranslationListView.as_view()),
url(r'order/advertising/$', AdvertisingListView.as_view()),
url(r'order/participation/$', ParticipationListView.as_view()),
url(r'order/remote/$', RemoteListView.as_view()),
url(r'order/tickets/$', TicketsListView.as_view()),
#ajax #ajax
url(r'^get_city/$', 'get_city'), url(r'^get_city/$', 'get_city'),
#url(r'^get_country/$', 'get_country'), #url(r'^get_country/$', 'get_country'),

@ -131,8 +131,8 @@ LANGS = [(_(u'Русский'), _(u'Русский'))]
from theme.models import Theme from theme.models import Theme
class TranslationForm(AbstractOrderForm): class TranslationForm(AbstractOrderForm):
languages = forms.CharField(required=False) languages = forms.CharField(required=False, widget=forms.TextInput(attrs={'placeholder': _(u'Знание языков')}))
themes = forms.CharField(required=False) themes = forms.CharField(required=False, widget=forms.TextInput(attrs={'placeholder': _(u'Тематика')}))
fr = forms.DateField(input_formats=settings.CLIENT_DATE_FORMAT, fr = forms.DateField(input_formats=settings.CLIENT_DATE_FORMAT,
widget=forms.DateInput(attrs={'class': 'date dateFrom', 'placeholder': _(u'дд.мм.гггг')})) widget=forms.DateInput(attrs={'class': 'date dateFrom', 'placeholder': _(u'дд.мм.гггг')}))
to = forms.DateField(input_formats=settings.CLIENT_DATE_FORMAT, to = forms.DateField(input_formats=settings.CLIENT_DATE_FORMAT,

@ -5,13 +5,6 @@ from views import ServiceView, CallBackListView, VisitListView, TranslationListV
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'service/thanks/$', Thanks.as_view()), url(r'service/thanks/$', Thanks.as_view()),
url(r'service/order/callback/$', CallBackListView.as_view()),
url(r'service/order/visit/$', VisitListView.as_view()),
url(r'service/order/translation/$', TranslationListView.as_view()),
url(r'service/order/advertising/$', AdvertisingListView.as_view()),
url(r'service/order/participation/$', ParticipationListView.as_view()),
url(r'service/order/remote/$', RemoteListView.as_view()),
url(r'service/order/tickets/$', TicketsListView.as_view()),
url(r'service/com_rek/$', 'service.views.advertise'), url(r'service/com_rek/$', 'service.views.advertise'),
url(r'service/(?P<url>.*)/$', ServiceView.as_view()), url(r'service/(?P<url>.*)/$', ServiceView.as_view()),

@ -7,6 +7,8 @@ from haystack.query import EmptySearchQuerySet
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.http import Http404 from django.http import Http404
import json import json
from django.http import HttpResponseRedirect, HttpResponse
from meta.views import MetadataMixin
#from functions.search_forms import CompanySearchForm #from functions.search_forms import CompanySearchForm
from order_forms import TranslationForm, CatalogForm, VisitForm, RemoteForm, ParticipationForm, TicketsForm,\ from order_forms import TranslationForm, CatalogForm, VisitForm, RemoteForm, ParticipationForm, TicketsForm,\
@ -16,22 +18,43 @@ from order_forms import TranslationForm, CatalogForm, VisitForm, RemoteForm, Par
order_forms = {'translator': TranslationForm, 'catalog': CatalogForm, 'participation': ParticipationForm, order_forms = {'translator': TranslationForm, 'catalog': CatalogForm, 'participation': ParticipationForm,
'remote': RemoteForm, 'tickets': TicketsForm, 'visit': VisitForm, 'buildstand': BuildStandForm} 'remote': RemoteForm, 'tickets': TicketsForm, 'visit': VisitForm, 'buildstand': BuildStandForm}
class ServiceView(FormView): meta = {'translator': 80, 'participation': 85,
'remote': 84, 'tickets': 81, 'visit': 82}
class ServiceView(MetadataMixin, FormView):
success_url = '/service/thanks/' success_url = '/service/thanks/'
def dispatch(self, request, *args, **kwargs):
service_url = self.kwargs.get('url')
service = get_object_or_404(Service, url=service_url)
self.service = service
self.template_name = service.template
service_form = order_forms.get(service_url)
self.form_class = service_form
return super(ServiceView, self).dispatch(request, *args, **kwargs)
def get_form_class(self): def post(self, request, *args, **kwargs):
url = self.kwargs.get('url') url = self.kwargs.get('url')
form = order_forms.get(url) #service_form = order_forms.get(url)
if form: #self.form_class = service_form
return form form = self.form_class(request.POST)
if form.is_valid():
return self.form_valid(form)
else: else:
raise Http404 return self.form_invalid(form)
def get_template_names(self): def form_valid(self, form):
order = form.save(commit=False)
order.save()
#messages.success(self.request, _(u'Ваш запрос был успешно отправлен'))
return HttpResponseRedirect(self.success_url)
def get_context_data(self, **kwargs):
url = self.kwargs.get('url') url = self.kwargs.get('url')
service = get_object_or_404(Service, url=url) meta_id = meta.get(url)
return service.template kwargs.update({'meta_id': meta_id})
return super(ServiceView, self).get_context_data(**kwargs)
def advertise(request): def advertise(request):

@ -20,7 +20,7 @@ urlpatterns = patterns('',
# theme # theme
url(r'^conference/theme-(?P<theme>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/{year}/{month}/'}), url(r'^conference/theme-(?P<theme>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/{year}/{month}/'}),
url(r'^conference/theme-(?P<theme>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/{year}/'}), url(r'^conference/theme-(?P<theme>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/{year}/'}),
url(r'^conference/theme-(?P<theme>.*)/city-(?P<city>.*)/year-(?P<year>\d+)/month-/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/city/{city}/{year}/'}), url(r'^conference/theme-(?P<theme>.*)/city-(?P<city>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/city/{city}/{year}/'}),
url(r'^conference/theme-(?P<theme>.*)/city-(?P<city>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/city/{city}/{year}/'}), url(r'^conference/theme-(?P<theme>.*)/city-(?P<city>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/city/{city}/{year}/'}),
url(r'^conference/theme-(?P<theme>.*)/city-(?P<city>.*)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/city/{city}/'}), url(r'^conference/theme-(?P<theme>.*)/city-(?P<city>.*)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/city/{city}/'}),
#url(r'^conference/theme/(?P<theme>.*)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/'}), # перенести #url(r'^conference/theme/(?P<theme>.*)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/'}), # перенести

@ -25,6 +25,8 @@ urlpatterns = patterns('',
url(r'^(?P<some>.*)/(?P<event>.*)/uchastie.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/participation/'}), url(r'^(?P<some>.*)/(?P<event>.*)/uchastie.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/participation/'}),
url(r'^(?P<some>.*)/(?P<event>.*)/ad.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/participation/'}), url(r'^(?P<some>.*)/(?P<event>.*)/ad.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/participation/'}),
url(r'^(?P<some>.*)/(?P<event>.*)/mobilestand.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/participation/'}), url(r'^(?P<some>.*)/(?P<event>.*)/mobilestand.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/participation/'}),
url(r'^(?P<some>.*)/(?P<event>.*)/catalogue.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/'}),
# company # company
url(r'^company/(?P<company>.*)$', old_redirect, {'redirect_url': '/members/{company}/'}), url(r'^company/(?P<company>.*)$', old_redirect, {'redirect_url': '/members/{company}/'}),
@ -43,32 +45,34 @@ urlpatterns = patterns('',
#url(r'^serv-personal-info.php$', old_redirect, {'redirect_url': '/service/staff/'}), #url(r'^serv-personal-info.php$', old_redirect, {'redirect_url': '/service/staff/'}),
# EXPO # EXPO
# city # city
url(r'^catalog/city-(?P<city>)/theme-(?P<theme>.*)/year-(?P<year>\d+)/month-/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/{year}/'}), url(r'^catalog/city-(?P<city>)/theme-(?P<theme>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/{year}/'}),
url(r'^catalog/city-(?P<city>.*)/theme-(?P<theme>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/{year}/'}), url(r'^catalog/city-(?P<city>.*)/theme-(?P<theme>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/{year}/'}),
url(r'^catalog/city-(?P<city>.*)/theme-(?P<theme>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/'}), url(r'^catalog/city-(?P<city>.*)/theme-(?P<theme>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/'}),
url(r'^catalog/city-(?P<city>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/city/{city}/{year}/{month}'}), url(r'^catalog/city-(?P<city>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/city/{city}/{year}/{month}'}),
url(r'^catalog/city/(?P<city>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/city/{city}/{year}/{month}'}), url(r'^catalog/city/(?P<city>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/city/{city}/{year}/{month}'}),
url(r'^catalog/city-(?P<city>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/city/{city}/{year}'}), url(r'^catalog/city-(?P<city>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/city/{city}/{year}'}),
url(r'^catalog/city/(?P<city>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/city/{city}/{year}'}), url(r'^catalog/city/(?P<city>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/city/{city}/{year}'}),
url(r'^catalog/city-(?P<city>.*)/page/(?P<page>\d+)/$', old_redirect, {'redirect_url': '/expo/city/{city}/page/{page}/'}),
url(r'^catalog/city-(?P<city>.*)/$', old_redirect, {'redirect_url': '/expo/city/{city}/'}), url(r'^catalog/city-(?P<city>.*)/$', old_redirect, {'redirect_url': '/expo/city/{city}/'}),
# country # country
url(r'^catalog/country-(?P<country>)/theme-(?P<theme>.*)/year-(?P<year>\d+)/month-/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/{year}/'}), url(r'^catalog/country-(?P<country>)/theme-(?P<theme>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/{year}/'}),
url(r'^catalog/country-(?P<country>.*)/theme-(?P<theme>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/{year}/'}), url(r'^catalog/country-(?P<country>.*)/theme-(?P<theme>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/{year}/'}),
url(r'^catalog/country-(?P<country>.*)/theme-(?P<theme>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/'}), url(r'^catalog/country-(?P<country>.*)/theme-(?P<theme>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/'}),
url(r'^catalog/country-(?P<country>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/country/{country}/{year}/{month}/'}), url(r'^catalog/country-(?P<country>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/country/{country}/{year}/{month}/'}),
url(r'^catalog/country/(?P<country>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/country/{country}/{year}/{month}/'}), url(r'^catalog/country/(?P<country>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/country/{country}/{year}/{month}/'}),
url(r'^catalog/country-(?P<country>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/country/{country}/{year}/'}), url(r'^catalog/country-(?P<country>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/country/{country}/{year}/'}),
url(r'^catalog/country/(?P<country>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/country/{country}/{year}/'}), url(r'^catalog/country/(?P<country>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/country/{country}/{year}/'}),
url(r'^catalog/country/(?P<country>.*)/$', old_redirect, {'redirect_url': '/expo/country/{country}/'}), url(r'^catalog/country/(?P<country>.*)/page/(?P<page>\d+)/$', old_redirect, {'redirect_url': '/expo/country/{country}/page/{page}/'}),
url(r'^catalog/country-(?P<country>.*)/$', old_redirect, {'redirect_url': '/expo/country/{country}/'}), url(r'^catalog/country-(?P<country>.*)/$', old_redirect, {'redirect_url': '/expo/country/{country}/'}),
url(r'^catalog/country/page/(?P<page>\d+)/$', old_redirect, {'redirect_url': '/expo/country/page/{page}/'}),
url(r'^catalog/country/$', old_redirect, {'redirect_url': '/expo/country/'}), url(r'^catalog/country/$', old_redirect, {'redirect_url': '/expo/country/'}),
# theme # theme
url(r'^catalog/theme-(?P<theme>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/{year}/{month}/'}), url(r'^catalog/theme-(?P<theme>.*)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/{year}/{month}/'}),
url(r'^catalog/theme-(?P<theme>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/{year}/'}), url(r'^catalog/theme-(?P<theme>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/{year}/'}),
url(r'^catalog/theme-(?P<theme>.*)/city-(?P<city>)/year-(?P<year>\d+)/month-/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/{year}/'}), url(r'^catalog/theme-(?P<theme>.*)/city-(?P<city>)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/{year}/'}),
url(r'^catalog/theme-(?P<theme>.*)/city-(?P<city>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/{year}/'}), url(r'^catalog/theme-(?P<theme>.*)/city-(?P<city>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/{year}/'}),
url(r'^catalog/theme-(?P<theme>.*)/city-(?P<city>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/'}), url(r'^catalog/theme-(?P<theme>.*)/city-(?P<city>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/city/{city}/'}),
url(r'^catalog/theme-(?P<theme>.*)/country-(?P<country>)/year-(?P<year>\d+)/month-/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/{year}/'}), url(r'^catalog/theme-(?P<theme>.*)/country-(?P<country>)/year-(?P<year>\d+)/month-(?P<month>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/{year}/'}),
url(r'^catalog/theme-(?P<theme>.*)/country-(?P<country>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/{year}/'}), url(r'^catalog/theme-(?P<theme>.*)/country-(?P<country>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/{year}/'}),
url(r'^catalog/theme-(?P<theme>.*)/country-(?P<country>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/'}), url(r'^catalog/theme-(?P<theme>.*)/country-(?P<country>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/country/{country}/'}),
url(r'^catalog/theme/(?P<theme>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/'}), url(r'^catalog/theme/(?P<theme>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/'}),

@ -50,12 +50,16 @@ class EventRedirect(object):
obj = Exposition.objects.get(old_url=value) obj = Exposition.objects.get(old_url=value)
except Exposition.DoesNotExist: except Exposition.DoesNotExist:
obj = Exposition.objects.safe_get(url=value) obj = Exposition.objects.safe_get(url=value)
except Exposition.MultipleObjectsReturned:
obj = Exposition.objects.filter(old_url=value)[0]
if not obj: if not obj:
try: try:
obj = Conference.objects.get(old_url=value) obj = Conference.objects.get(old_url=value)
except Conference.DoesNotExist: except Conference.DoesNotExist:
obj = Conference.objects.safe_get(url=value) obj = Conference.objects.safe_get(url=value)
except Conference.MultipleObjectsReturned:
obj = Conference.objects.filter(old=value)[0]
if obj: if obj:
return {'event_url': obj.url, 'event_catalog': obj.catalog} return {'event_url': obj.url, 'event_catalog': obj.catalog}
else: else:
@ -71,9 +75,15 @@ class UserRedirect(object):
obj = get_object_or_404(User, url=value) obj = get_object_or_404(User, url=value)
return {key: obj.url} return {key: obj.url}
class PageRedirect(object):
def get_object_url(self,key, value):
return {key: value}
old_params = {'city': CityRedirect, 'country': CountryRedirect, 'theme': ThemeRedirect, 'tag': TagRedirect, old_params = {'city': CityRedirect, 'country': CountryRedirect, 'theme': ThemeRedirect, 'tag': TagRedirect,
'event': EventRedirect, 'company': Company, 'article': ArticleRedirect, 'user': UserRedirect} 'event': EventRedirect, 'company': Company, 'article': ArticleRedirect, 'user': UserRedirect,
'page': PageRedirect}
def old_redirect(request, *args, **kwargs): def old_redirect(request, *args, **kwargs):
redirect = kwargs.get('redirect_url') redirect = kwargs.get('redirect_url')

@ -13,6 +13,21 @@
<script src="{% static 'custom_js/file_post_ajax.js' %}"></script> <script src="{% static 'custom_js/file_post_ajax.js' %}"></script>
<script src="{% static 'custom_js/select_tag.js' %}"></script> <script src="{% static 'custom_js/select_tag.js' %}"></script>
<link href="{% static 'js/datetimepicker/css/datetimepicker.css' %}" rel="stylesheet"/>
<script src="{% static 'js/datetimepicker/js/bootstrap-datetimepicker.js' %}"></script>
<script>
$(document).ready(function(){
$('#id_publish_date').datetimepicker({
todayHighlight: true,
format : 'yyyy-mm-dd',
minView:2
});
});
</script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
@ -29,6 +44,14 @@
{# main_title #} {# main_title #}
{% include 'admin/forms/multilang.html' with field='main_title' form=form languages=languages %} {% include 'admin/forms/multilang.html' with field='main_title' form=form languages=languages %}
<div class="control-group {% if form.publish_date.errors %}error{% endif %}">
<label class="control-label"><b>{{ form.publish_date.label }}:</b></label>
<div class="controls">
{{ form.publish_date }}
<span class="help-inline">{{ form.publish_date.errors }}</span>
</div>
</div>
{# theme #} {# theme #}
<div class="control-group {% if form.theme.errors %}error{% endif %}"> <div class="control-group {% if form.theme.errors %}error{% endif %}">
<label class="control-label"><b>{{ form.theme.label }}:</b></label> <label class="control-label"><b>{{ form.theme.label }}:</b></label>
@ -131,4 +154,46 @@
</form> </form>
{% include 'admin/includes/file_form.html' with file_form=file_form object=article %} {% include 'admin/includes/file_form.html' with file_form=file_form object=article %}
{% endblock %}
{% block bot_scripts %}
<script>
$(document).ready(function(){
$('#id_exposition').select2({
placeholder: "Выставки",
multiple: true,
ajax: {
url: "/admin/exposition/search/",
width: '550px',
dataType: "json",
quietMillis: 200,
data: function(term, page, theme){
return {term: term,
page: page};
},
results: function (data) {
var results = [];
$.each(data, function(index, item){
results.push({
id: item.id,
text: item.label
});
});
return {results: results};
}
},
initSelection : function(element, callback) {
var id= $(element).val();
var text = $(element).attr('data-init-text');
callback({id: id, text:text});
}
});
});
</script>
{% endblock %} {% endblock %}

@ -19,7 +19,10 @@
{% include 'client/includes/article/article_logo.html' with obj=object %} {% include 'client/includes/article/article_logo.html' with obj=object %}
<h1>{{ object.main_title }}</h1> <h1>{{ object.main_title }}</h1>
<strong><span>{{ object.created|date:"d E Y" }}</span><a class="profile_link" href="{{ object.author.get_permanent_url }}" title="">{{ object.author.get_full_name }}</a></strong> <strong><span>{{ object.publish_date|date:"d E Y" }}</span><a class="profile_link" href="{{ object.author.get_permanent_url }}" title="">{{ object.author.get_full_name }}</a></strong>
{% if request.user.is_admin %}
<a target="_blank" class="button green " href="/admin/article/blog/{{ object.slug }}/">{% trans 'изменить' %}</a>
{% endif %}
<p style="text-align: justify" align="justify">&nbsp;</p><hr> <p style="text-align: justify" align="justify">&nbsp;</p><hr>
<div class="content-text"> <div class="content-text">
{{ object.description|safe }} {{ object.description|safe }}

@ -20,7 +20,10 @@
{% include 'includes/article/article_logo.html' with obj=object %} {% include 'includes/article/article_logo.html' with obj=object %}
<h1>{{ object.main_title }}</h1> <h1>{{ object.main_title }}</h1>
<strong><span>{{ object.created|date:"d E Y" }}</span>{% if object.get_event %}<a class="flag" href="{{ object.get_event.get_permanent_url }}" title="">{{ object.get_event.name }}</a>{% endif %}</strong> <strong><span>{{ object.published|date:"d E Y" }}</span>{% if object.get_event %}<a class="flag" href="{{ object.get_event.get_permanent_url }}" title="">{{ object.get_event.name }}</a>{% endif %}</strong>
{% if request.user.is_admin %}
<a target="_blank" class="button green " href="/admin/article/news/{{ object.slug }}/">{% trans 'изменить' %}</a>
{% endif %}
</div> </div>
<div class="content-text"> <div class="content-text">
{{ object.description|safe }} {{ object.description|safe }}

@ -22,7 +22,7 @@
{% if theme_for_filter.id == 27 or theme_for_filter.id == 9 or theme_for_filter.id == 48 %} {% if theme_for_filter.id == 27 or theme_for_filter.id == 9 or theme_for_filter.id == 48 %}
<div class="sbnr"> <div class="sbnr">
<div class="sbnr-wrap"> <div class="sbnr-wrap">
<a href="/redirect/redirect/11/"> <a href="/redirect/redirect/11/" target="_blank">
<img src="{% static 'client/img/partners/ipsa_.gif' %}" alt="" /> <img src="{% static 'client/img/partners/ipsa_.gif' %}" alt="" />
</a> </a>
</div> </div>
@ -69,7 +69,7 @@
{% endwith %} {% endwith %}
{% block under_search_baner %} {% block under_search_baner %}
<div class="abn"> <div class="abn">
<a href="/redirect/redirect/10/"><img src="{% static 'client/img/partners/wire_760x70.gif' %}" alt="" /></a> <a target="_blank" href="/redirect/redirect/10/"><img src="{% static 'client/img/partners/wire_760x70.gif' %}" alt="" /></a>
</div> </div>
{% endblock %} {% endblock %}

@ -16,11 +16,11 @@
{% endblock %} {% endblock %}
{% block content_list %} {% block content_list %}
{% ifnotequal object.url 'ipsa-osen-2015' %} {% if not object.paid %}
{% include 'client/includes/exposition/exposition_object.html' with exposition=object %} {% include 'client/includes/exposition/exposition_object.html' with exposition=object %}
{% else %} {% else %}
{% include 'client/includes/exposition/expo_paid.html' with exposition=object %} {% include 'client/includes/exposition/expo_paid.html' with exposition=object %}
{% endifnotequal %} {% endif %}
{% endblock %} {% endblock %}
{% block paginator %} {% block paginator %}

@ -33,9 +33,7 @@
<div class="paid-partner-block"> <div class="paid-partner-block">
<p class="partner-title">{% trans 'Организатор' %}</p> <p class="partner-title">{% trans 'Организатор' %}</p>
<div class="i-pict"> <div class="i-pict">
<img src="{{ exposition.paid.org_logo.url }}" class="pic" alt=""> <img src="{{ exposition.paid.org_logo.url }}" class="pic" alt="">
</div> </div>
</div> </div>
{% endif %} {% endif %}
@ -117,7 +115,7 @@
</div> </div>
<div class="i-sub-articles"> <div class="i-sub-articles">
<a href="{{ exposition.paid.oficial_link.get_object_url }}" class="paid-partner-link">{% trans 'Официальный сайт выставки' %}</a> <a target="_blank" href="{{ exposition.paid.oficial_link.get_object_url }}" class="paid-partner-link">{% trans 'Официальный сайт выставки' %}</a>
</div> </div>

@ -78,7 +78,7 @@
{% endwith %} {% endwith %}
</div> </div>
{% if request.user.is_admin %} {% if request.user.is_admin %}
<a class="button green " href="/admin/exposition/{{ object.url }}/">{% trans 'изменить' %}</a> <a target="_blank" class="button green " href="/admin/exposition/{{ object.url }}/">{% trans 'изменить' %}</a>
{% endif %} {% endif %}
</div> </div>
<div class="ib-add"><a class="button blue2 icon-find" href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ object.city.id }}">{% trans 'Найти отель' %}</a></div> <div class="ib-add"><a class="button blue2 icon-find" href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ object.city.id }}">{% trans 'Найти отель' %}</a></div>

@ -151,7 +151,11 @@
<div class="tp-btn-wrap"> <div class="tp-btn-wrap">
<div class="tp-btn"> <div class="tp-btn">
{% if not exposition.paid %}
<a class="button big orange b-more" href="{{ exposition.get_permanent_url }}service/tickets/">{% trans 'Заказать билет' %}</a> <a class="button big orange b-more" href="{{ exposition.get_permanent_url }}service/tickets/">{% trans 'Заказать билет' %}</a>
{% else %}
<a class="button big orange" href="{{ exposition.paid.tickets_link.get_object_url }}">{% trans 'Заказать билет' %}</a>
{% endif %}
</div> </div>
{% if exposition.get_audience %} {% if exposition.get_audience %}
<div class="tp-categories"> <div class="tp-categories">
@ -215,8 +219,11 @@
{% else %} {% else %}
<p class="mb-2em">{% trans 'Цены на площадь доступны по запросу' %}</p> <p class="mb-2em">{% trans 'Цены на площадь доступны по запросу' %}</p>
{% endif %} {% endif %}
{% if not exposition.paid %}
<a class="button big orange b-more" href="{{ exposition.get_permanent_url }}service/participation/">{% trans 'Заявка на участие' %}</a> <a class="button big orange" href="{{ exposition.get_permanent_url }}service/participation/">{% trans 'Заявка на участие' %}</a>
{% else %}
<a class="button big orange" href="{{ exposition.paid.participation_link.get_object_url }}">{% trans 'Заявка на участие' %}</a>
{% endif %}
{% if exposition.min_stand_size or exposition.registration_payment or exposition.application_deadline %} {% if exposition.min_stand_size or exposition.registration_payment or exposition.application_deadline %}
<div class="epr-conditons"> <div class="epr-conditons">

@ -14,9 +14,9 @@
<li><a href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ obj.city.id }}&do_availability_check=on&label=expo_search&lang={{ request.LANGUAGE_CODE }}&checkin_monthday={{ obj.data_begin|date:'j' }}&checkin_year_month={{ obj.data_begin|date:'Y' }}-{{ obj.data_begin|date:'n' }}&checkout_monthday={{ obj.data_end|date:'j' }}&checkout_year_month={{ obj.data_end|date:'Y' }}-{{ obj.data_end|date:'n' }}">{% trans 'Заказать отель' %}</a></li> <li><a href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ obj.city.id }}&do_availability_check=on&label=expo_search&lang={{ request.LANGUAGE_CODE }}&checkin_monthday={{ obj.data_begin|date:'j' }}&checkin_year_month={{ obj.data_begin|date:'Y' }}-{{ obj.data_begin|date:'n' }}&checkout_monthday={{ obj.data_end|date:'j' }}&checkout_year_month={{ obj.data_end|date:'Y' }}-{{ obj.data_end|date:'n' }}">{% trans 'Заказать отель' %}</a></li>
{% endif %} {% endif %}
{% else %} {% else %}
<li><a href="{{ obj.paid.oficial_link.get_object_url }}">{% trans 'Официальный сайт' %}</a></li> <li><a target="_blank" href="{{ obj.paid.oficial_link.get_object_url }}">{% trans 'Официальный сайт' %}</a></li>
<li><a href="{{ obj.paid.tickets_link.get_object_url }}">{% trans 'Билеты на выставку' %}</a></li> <li><a target="_blank" href="{{ obj.paid.tickets_link.get_object_url }}">{% trans 'Билеты на выставку' %}</a></li>
<li><a href="{{ obj.paid.participation_link.get_object_url }}">{% trans 'Заявка на участие' %}</a></li> <li><a target="_blank" href="{{ obj.paid.participation_link.get_object_url }}">{% trans 'Заявка на участие' %}</a></li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>

@ -167,7 +167,11 @@
<div class="rq-order-button"> <div class="rq-order-button">
<div class="rqob-wrap"> <div class="rqob-wrap">
<div class="rqob-price">{% trans 'Стоимость базового пакета услуги 400 €' %}</div> {% if object and object.country_id in sng_countries %}
<div class="rqob-price">{% trans 'Стоимость базового пакета услуги 10 000 р.' %}</div>
{% else %}
<div class="rqob-price">{% trans 'Стоимость базового пакета услуги 400 €' %}</div>
{% endif %}
<div class="rqob-button"> <div class="rqob-button">
<a class="ob-text" href="#">{% trans 'отправить запрос' %}</a> <a class="ob-text" href="#">{% trans 'отправить запрос' %}</a>
</div> </div>

@ -20,7 +20,8 @@
<p>Также Вы можете позвонить нам для ускорения процесса, если Ваш запрос является срочным.</p> <p>Также Вы можете позвонить нам для ускорения процесса, если Ваш запрос является срочным.</p>
</article> </article>
<div class="clearfix"></div> <div class="clearfix"></div>
{% comment %} {% if object %}
<h3>Что дальше Вы хотите делать?</h3> <h3>Что дальше Вы хотите делать?</h3>
<div class="help-block"> <div class="help-block">
<div class="item"> <div class="item">
@ -28,11 +29,14 @@
<div class="icon list">&nbsp;</div> <div class="icon list">&nbsp;</div>
</div> </div>
<div class="desc"> <div class="desc">
{% with theme=object.theme.all.0 %}
<p> <p>
Перейти к списку выставок по тематике <a href="#">«Ювелирное дело, антиквариат»</a> Перейти к списку выставок по тематике <a href="{{ object.catalog }}theme/{{ theme.url }}/">«{{ theme.name }}»</a>
</p> </p>
{% endwith %}
</div> </div>
</div> </div>
{% comment %}
<div class="item"> <div class="item">
<div class="figure"> <div class="figure">
<div class="icon mail">&nbsp;</div> <div class="icon mail">&nbsp;</div>
@ -43,17 +47,31 @@
</p> </p>
</div> </div>
</div> </div>
{% endcomment %}
<div class="item"> <div class="item">
<div class="figure"> <div class="figure">
<div class="icon zoom">&nbsp;</div> <div class="icon zoom">&nbsp;</div>
</div> </div>
<div class="desc"> <div class="desc">
Вернуться к просмотру выставки <a href="#">«Сувенирная ярмарка 2013/2014»</a> Вернуться к просмотру выставки <a href="{{ object.get_permanent_url }}">«{{ object.name }}»</a>
</div>
</div>
<div class="item">
<div class="figure">
<div class="icon list">&nbsp;</div>
</div>
<div class="desc">
{% with city=object.city %}
<p>
Перейти к списку ближайших выставок в городе <a href="{{ object.catalog }}city/{{ city.url }}/">«{{ city.name }}»</a>
</p>
{% endwith %}
</div> </div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
{% endcomment %}
</div> </div>
{% endif %}
</div> </div>
</div> </div>

@ -62,11 +62,13 @@
<div class="mf-line cols-2 rq-trans"> <div class="mf-line cols-2 rq-trans">
<div class="mf-field"> <div class="mf-field">
{{ form.languages }}
<input id="id_languages" name="languages" placeholder="{% trans 'Знание языков' %}" type="text" value="{{ form.languages.value }}"> <input id="id_languages" name="languages" placeholder="{% trans 'Знание языков' %}" type="text" value="{{ form.languages.value }}">
</div> </div>
<div class="mf-field"> <div class="mf-field">
{{ form.themes }}
<input id="id_themes" name="themes" placeholder="{% trans 'Тематика' %}" type="text" value="{{ form.themes.value }}"> <input id="id_themes" name="themes" placeholder="{% trans 'Тематика' %}" type="text" value="{{ form.themes.value }}">
</div> </div>

@ -4,55 +4,23 @@ import xlrd, xlwt
from django.conf import settings from django.conf import settings
from import_xls.excel_settings import import_settings from import_xls.excel_settings import import_settings
INFLECT_FILE = settings.MEDIA_ROOT+'/import/themes_inflect.xls'
class Command(BaseCommand): class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
f = open(settings.MEDIA_ROOT+'/import/tags2.xls', 'r') f = open(INFLECT_FILE, 'r')
book = xlrd.open_workbook(file_contents=f.read()) book = xlrd.open_workbook(file_contents=f.read())
sheet = book.sheet_by_index(0) sheet = book.sheet_by_index(0)
row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)] row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)]
# all field names in excel file (must be in second row) # all field names in excel file (must be in second row)
field_names = [name for name in row_list[1]] field_names = [name for name in row_list[1]]
for row_number, row in enumerate(row_list):
# go through all rows in file
if row_number > 1:
# first two fields are verbose name and name
if row[0] != '':
# in first column ids
try:
object = Tag.objects.language('en').get(id=int(row[0]))
except:
continue
for col_number, cell in enumerate(row):
# go through row cells
# field name current cell
field_name = field_names[col_number]
setting = import_settings.get(field_name)
if setting is not None:
# if setting exist for this field
func = setting.get('func')
if func is not None:
extra_value = setting.get('extra_values')
if extra_value is not None:
# if setting has extra value then
# it is some field like city, theme, tag
# that has relation and can be created
# in function we add language(need for relation fields) for row_number, row in enumerate(row_list[2:]):
# and extra value from object (like for city need country) id = int(row[0])
value = func(cell, 'en', getattr(object, extra_value)) a = row[3]
else: print a.encode('utf8')
value = func(cell) Theme.objects.filter(id=id).update(inflect=a)
if field_name != 'theme':
setattr(object, field_name, value)
else:
setattr(object, field_name, value[0])
print('pre save %s'%str(object))
try:
object.save()
except:
pass
print('post save %s'%str(object))
Loading…
Cancel
Save