Merge branch 'stage4' into stage5

remotes/origin/stage5
Alexander Burdeiny 10 years ago
commit 445a7a485e
  1. 35
      accounts/views.py
  2. 102
      conference/urls.py
  3. 100
      exposition/urls.py
  4. 12
      meta/models.py
  5. 4
      place_exposition/urls.py
  6. 65
      proj/middleware.py
  7. 1
      settings/old_urls.py
  8. 1
      support/dev/settings.py
  9. 2
      support/prod/settings.py
  10. 2
      templates/client/article/news.html
  11. 4
      templates/client/includes/place/place_object.html

@ -207,12 +207,7 @@ class ProfileCompanyView(TemplateView):
return context
class UserView(MetadataMixin, TemplateView):
"""
display user information for another users
"""
template_name = 'client/accounts/user.html'
class UserMixin(object):
def get_user(self):
url = self.kwargs.get('url')
@ -224,6 +219,14 @@ class UserView(MetadataMixin, TemplateView):
self.kwargs['user_full_name'] = user.get_full_name()
return user
class UserView(UserMixin, MetadataMixin, TemplateView):
"""
display user information for another users
"""
template_name = 'client/accounts/user.html'
def get_context_data(self, **kwargs):
user = self.get_user()
context = super(UserView, self).get_context_data(**kwargs)
@ -368,11 +371,11 @@ class UserEventView(ListView):
obj = None
event_type = None
def get_queryset(self):
url = self.kwargs.get('url')
user = get_user(url)
self.obj = user
return user.exposition_users.language().select_related('country').all()
# def get_queryset(self):
# url = self.kwargs.get('url')
# user = get_user(url)
# self.obj = user
# return user.exposition_users.language().select_related('country').all()
def get_context_data(self, **kwargs):
context = super(UserEventView, self).get_context_data(**kwargs)
@ -381,29 +384,27 @@ class UserEventView(ListView):
return context
class UserExpositionsView(MetadataMixin, UserEventView):
class UserExpositionsView(UserMixin, MetadataMixin, UserEventView):
"""
return template with list of expos that user joined
"""
event_type = _(u'Выставки')
def get_queryset(self):
url = self.kwargs.get('url')
user = get_user(url)
user = self.get_user()
self.obj = user
self.kwargs['user_full_name'] = user.get_full_name()
return user.get_expos()
class UserConferenceView(MetadataMixin, UserEventView):
class UserConferenceView(UserMixin, MetadataMixin, UserEventView):
"""
return template with list of confs that user joined
"""
event_type = _(u'Конференции')
def get_queryset(self):
url = self.kwargs.get('url')
user = get_user(url)
user = self.get_user()
self.obj = user
self.kwargs['user_full_name'] = user.get_full_name()
return user.get_confs()

@ -23,81 +23,81 @@ from .views import (
urlpatterns = patterns('',
url(r'^conference/add-note/(?P<slug>.*)/$', 'conference.views.add_note'),
url(r'^conference/add-note/(?P<slug>[^/]*)/$', 'conference.views.add_note'),
url(r'^conference-add-calendar/(?P<id>\d+)/$', 'conference.views.conference_add_calendar'),
url(r'^conference-visit/(?P<id>\d+)/$', 'conference.views.conference_visit'),
# search
url(r'^conference/search/', ExpositionSearchView.as_view()),
# country catalog
url(r'^conference/country/$', ConferenceByCountry.as_view(), {'meta_id':51}),
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}),
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}, name='conf_country'),
# city catalog
url(r'^conference/city/$', ConferenceByCity.as_view(), {'meta_id':52}),
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}),
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}, name='conf_city'),
# theme catalog
url(r'^conference/theme/$', ConferenceByTheme.as_view(), {'meta_id':50}),
url(r'^conference/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceThemeCatalog.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>.*)/(?P<year>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>[^/]*)/country/(?P<country_slug>[^/]*)/(?P<year>\d+)/(?P<month>[^/]*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>[^/]*)/country/(?P<country_slug>[^/]*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>[^/]*)/country/(?P<country_slug>[^/]*)/(?P<year>\d+)/(?P<month>[^/]*)/$', ConferenceThemeCatalog.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>[^/]*)/(?P<year>\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>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/(?P<year>\d+)/$', 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>[^/]*)/(?P<year>\d+)/(?P<month>[^/]*)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>[^/]*)/city/(?P<city_slug>[^/]*)/(?P<year>\d+)/(?P<month>[^/]*)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>[^/]*)/city/(?P<city_slug>[^/]*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ConferenceThemeCatalog.as_view()),
url(r'^conference/theme/(?P<slug>[^/]*)/city/(?P<city_slug>[^/]*)/(?P<year>\d+)/$', 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>.*)/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(), {'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}),
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(), {'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/$', ConferenceByTag.as_view(), {'meta_id':50}),
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}),
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>.*)/send_to_organiser/$', 'conference.views.send_to_organiser'),
url(r'^conference/(?P<slug>.*)/photo/page/(?P<page>\d+)/$', ConferencePhotoView.as_view(), {'meta_id': 93}),
url(r'^conference/(?P<slug>.*)/photo/$', ConferencePhotoView.as_view(), {'meta_id': 93}),
url(r'^conference/(?P<slug>.*)/visitors/page/(?P<page>\d+)/$', 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/$', ConferenceMembers.as_view()),
url(r'^conference/(?P<slug>.*)/service/thanks/', ConferenceThankView.as_view()),
url(r'^conference/(?P<slug>.*)/service/visit/', 'conference.views.visit_redirect'),
url(r'^conference/(?P<slug>[^/]*)/send_to_organiser/$', 'conference.views.send_to_organiser'),
url(r'^conference/(?P<slug>[^/]*)/photo/page/(?P<page>\d+)/$', ConferencePhotoView.as_view(), {'meta_id': 93}),
url(r'^conference/(?P<slug>[^/]*)/photo/$', ConferencePhotoView.as_view(), {'meta_id': 93}),
url(r'^conference/(?P<slug>[^/]*)/visitors/page/(?P<page>\d+)/$', 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/$', ConferenceMembers.as_view()),
url(r'^conference/(?P<slug>[^/]*)/service/thanks/', ConferenceThankView.as_view()),
url(r'^conference/(?P<slug>[^/]*)/service/visit/', 'conference.views.visit_redirect'),
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
url(r'^conference/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ConferenceList.as_view(), {'meta_id':22}),
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+)/(?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(), {'meta_id':35}),
url(r'^conference/(?P<slug>[^/]*)/$', ConferenceDetail.as_view(), {'meta_id':35}),
url(r'^conference/$', ConferenceList.as_view(), {'meta_id':20}),
)

@ -32,65 +32,65 @@ urlpatterns = patterns('',
# country catalog
url(r'^expo/country/$', ExpositionByCountry.as_view(), {'meta_id':54}),
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}),
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}, name='expo_country'),
# city catalog
url(r'^expo/city/$', ExpositionByCity.as_view(), {'meta_id':53}),
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}),
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}, name='expo_city'),
# theme catalog
url(r'^expo/theme/$', ExpositionByTheme.as_view(), {'meta_id':55}),
url(r'^expo/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':44}),
url(r'^expo/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':44}),
url(r'^expo/theme/(?P<slug>.*)/country/(?P<country_slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoThemeCatalog.as_view(), {'meta_id':44}),
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>.*)/(?P<year>\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>[^/]*)/country/(?P<country_slug>[^/]*)/(?P<year>\d+)/(?P<month>[^/]*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':44}),
url(r'^expo/theme/(?P<slug>[^/]*)/country/(?P<country_slug>[^/]*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':44}),
url(r'^expo/theme/(?P<slug>[^/]*)/country/(?P<country_slug>[^/]*)/(?P<year>\d+)/(?P<month>[^/]*)/$', ExpoThemeCatalog.as_view(), {'meta_id':44}),
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>[^/]*)/(?P<year>\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>.*)/(?P<year>\d+)/(?P<month>.*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
url(r'^expo/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/(?P<year>\d+)/(?P<month>.*)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
url(r'^expo/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
url(r'^expo/theme/(?P<slug>.*)/city/(?P<city_slug>.*)/(?P<year>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
url(r'^expo/theme/(?P<slug>[^/]*)/city/(?P<city_slug>[^/]*)/(?P<year>\d+)/(?P<month>[^/]*)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
url(r'^expo/theme/(?P<slug>[^/]*)/city/(?P<city_slug>[^/]*)/(?P<year>\d+)/(?P<month>[^/]*)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
url(r'^expo/theme/(?P<slug>[^/]*)/city/(?P<city_slug>[^/]*)/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
url(r'^expo/theme/(?P<slug>[^/]*)/city/(?P<city_slug>[^/]*)/(?P<year>\d+)/$', ExpoThemeCatalog.as_view(), {'meta_id':42}),
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>.*)/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}),
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(), {'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}),
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>.*)/send_to_organiser/$', 'exposition.views.send_to_organiser'),
url(r'^expo/(?P<slug>.*)/statistic/$', ExpositionStatistic.as_view(), {'meta_id':60}),
url(r'^expo/(?P<slug>.*)/price/$', ExpositionPrice.as_view(), {'meta_id':61}),
url(r'^expo/(?P<slug>.*)/program/$', ExpositionProgramme.as_view(), {'meta_id':62}),
url(r'^expo/(?P<slug>.*)/visitors/page/(?P<page>\d+)/$', ExpoVisitors.as_view(), {'meta_id':64}),
url(r'^expo/(?P<slug>.*)/visitors/$', ExpoVisitors.as_view(), {'meta_id':64}),
url(r'^expo/(?P<slug>.*)/photo/page/(?P<page>\d+)/$', ExpoPhotoView.as_view(), {'meta_id': 92}),
url(r'^expo/(?P<slug>.*)/photo/$', ExpoPhotoView.as_view(), {'meta_id': 92}),
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>.*)/service/thanks/', ExpositionThankView.as_view()),
url(r'^expo/(?P<slug>.*)/service/visit/', 'exposition.views.visit_redirect'),
url(r'^expo/(?P<slug>.*)/service/(?P<service_url>.*)/', ExpositionServiceView.as_view()),
url(r'^expo/(?P<slug>[^/]*)/send_to_organiser/$', 'exposition.views.send_to_organiser'),
url(r'^expo/(?P<slug>[^/]*)/statistic/$', ExpositionStatistic.as_view(), {'meta_id':60}),
url(r'^expo/(?P<slug>[^/]*)/price/$', ExpositionPrice.as_view(), {'meta_id':61}),
url(r'^expo/(?P<slug>[^/]*)/program/$', ExpositionProgramme.as_view(), {'meta_id':62}),
url(r'^expo/(?P<slug>[^/]*)/visitors/page/(?P<page>\d+)/$', ExpoVisitors.as_view(), {'meta_id':64}),
url(r'^expo/(?P<slug>[^/]*)/visitors/$', ExpoVisitors.as_view(), {'meta_id':64}),
url(r'^expo/(?P<slug>[^/]*)/photo/page/(?P<page>\d+)/$', ExpoPhotoView.as_view(), {'meta_id': 92}),
url(r'^expo/(?P<slug>[^/]*)/photo/$', ExpoPhotoView.as_view(), {'meta_id': 92}),
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>[^/]*)/service/thanks/', ExpositionThankView.as_view()),
url(r'^expo/(?P<slug>[^/]*)/service/visit/', 'exposition.views.visit_redirect'),
url(r'^expo/(?P<slug>[^/]*)/service/(?P<service_url>[^/]*)/', ExpositionServiceView.as_view()),
# 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}),
url(r'^expo/(?P<year>\d+)/page/(?P<page>\d+)/$', ExpoList.as_view(), {'meta_id':3}),
url(r'^expo/(?P<year>\d+)/(?P<month>.*)/$', ExpoList.as_view(), {'meta_id':4}),
url(r'^expo/(?P<year>\d+)/$', ExpoList.as_view(), {'meta_id':3}),

@ -150,14 +150,12 @@ class SeoTextManager(TranslationManager):
url = kwargs.get('url')
lang = kwargs.get('lang')[:2] or translation.get_language()[:2]
key = 'seo_text_cache'
if key in cache:
result = cache.get(key)
return result.get("%s_%s" % (lang, url))
else:
result = cache.get(key)
if result is None:
qs = list(SeoText.objects.language('all'))
value_dict = {obj.language_code+'_'+obj.url: obj for obj in qs}
cache.set(key, value_dict, self.cache_time)
return value_dict.get("%s_%s" % (lang, url))
result = {obj.language_code+'_'+obj.url: obj for obj in qs}
cache.set(key, result, self.cache_time)
return result.get("%s_%s" % (lang, url), None)
class SeoText(TranslatableModel):

@ -15,11 +15,11 @@ urlpatterns = patterns('',
url(r'^country/$', PlaceByCountry.as_view(), {'meta_id': 49}),
url(r'^country/(?P<slug>.*)/page/(?P<page>\d+)/$', PlaceCountryCatalog.as_view(), {'meta_id': 49}),
url(r'^country/(?P<slug>.*)/$', PlaceCountryCatalog.as_view(), {'meta_id': 49}),
url(r'^country/(?P<slug>.*)/$', PlaceCountryCatalog.as_view(), {'meta_id': 49}, name='place_country'),
url(r'^city/$', PlaceByCity.as_view(), {'meta_id': 48}),
url(r'^city/(?P<slug>.*)/page/(?P<page>\d+)/$', PlaceCityCatalog.as_view(), {'meta_id': 48}),
url(r'^city/(?P<slug>.*)/$', PlaceCityCatalog.as_view(), {'meta_id': 48}),
url(r'^city/(?P<slug>.*)/$', PlaceCityCatalog.as_view(), {'meta_id': 48}, name='place_city'),
url(r'^(?P<slug>.*)/photo/page/(?P<page>\d+)/$', PlacePhoto.as_view(), {'meta_id': 91}),
url(r'^(?P<slug>.*)/photo/$', PlacePhoto.as_view(), {'meta_id': 91}),

@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
# from django.contrib.redirects.middleware import RedirectFallbackMiddleware
import re
from django.http import HttpResponsePermanentRedirect
from django.core.urlresolvers import reverse
from exposition.models import Exposition
from country.models import Country
from city.models import City
class RedirectFallbackMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a redirect for non-404 responses.
full_path = request.get_full_path()
redirects = [
(r'^/(?P<event_type>expo|conference)/(?P<slug>[^/]*)/$', check_events),
(r'^/places/(?P<slug>[^/]*)/$', check_places),
]
for regex, handler in redirects:
check = re.compile(regex)
match = check.match(full_path)
if match:
response = handler(**match.groupdict())
if response is not None:
return response
return response
def check_events(event_type, slug):
'''
Event redirects (ticket 1498: Внепланово со скайпа - редиректы 301)
https://expomap.ru/expo/dusseldorf/ -> https://expomap.ru/expo/city/dusseldorf/
https://expomap.ru/expo/moscow/ -> https://expomap.ru/expo/country/moscow/
https://expomap.ru/conference/berlin/ -> https://expomap.ru/conference/city/berlin/
https://expomap.ru/conference/moscow/ -> https://expomap.ru/conference/country/moscow/
'''
types = {
'expo': 'expo',
'conference': 'conf'
}
if City.objects.filter(url=slug).exists():
return HttpResponsePermanentRedirect(reverse(types.get(event_type) + '_city', kwargs={'slug': slug}))
if Country.objects.filter(url=slug).exists():
return HttpResponsePermanentRedirect(reverse(types.get(event_type) + '_country', kwargs={'slug': slug}))
return None
def check_places(slug):
"""
Правила для старых ошибок (ticket 1498: Внепланово со скайпа - редиректы 301)
https://expomap.ru/places/russia/ -> https://expomap.ru/places/country/russia/
https://expomap.ru/places/moscow/ -> https://expomap.ru/places/city/moscow/
- где пропущен параметр city и country - тоже автоматической склейки по 301
"""
if City.objects.filter(url=slug).exists():
return HttpResponsePermanentRedirect(reverse('place_city', kwargs={'slug': slug}))
if Country.objects.filter(url=slug).exists():
return HttpResponsePermanentRedirect(reverse('place_country', kwargs={'slug': slug}))
return None

@ -39,6 +39,7 @@ urlpatterns = patterns('',
url(r'^newsp.php/news_id/(?P<news_p>\d+)/(?P<some>.*)$', old_redirect, {'redirect_url': '/news/{news_p}/'}),
# users
url(r'^users/(?P<user>.*)$', old_redirect, {'redirect_url': '/{user}/'}),
url(r'^user/(?P<user>.*)$', old_redirect, {'redirect_url': '/{user}/'}),
url(r'^account_edit.php$', old_profile),
url(r'^myexpo.php$', old_redirect, {'redirect_url': '/profile/calendar/'}),
url(r'^newsletter2.php?email=(?P<some>.*)$', old_redirect, {'redirect_url': '/profile/settings/'}),

@ -153,6 +153,7 @@ MIDDLEWARE_CLASSES = (
# Uncomment the next line for simple clickjacking protection:
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
'proj.middleware.RedirectFallbackMiddleware',
)

@ -153,7 +153,7 @@ MIDDLEWARE_CLASSES = (
# Uncomment the next line for simple clickjacking protection:
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
'proj.middleware.RedirectFallbackMiddleware',
)

@ -55,7 +55,7 @@
</div>
<div class="rq-to-hide">
<div class="s-comments">
<div class="sect-title blog_link"><span>{% trans 'Последние новости' %} {{ object.main_title }}</span><a class="button more" href="/news/">{% trans 'Все новости' %}</a></div>
<div class="sect-title blog_link"><span>{% trans 'Последние новости' %}</span><a class="button more" href="/news/">{% trans 'Все новости' %}</a></div>
<div class="cat-list sc-comments">
{% for news in object.similar %}
<div class="cl-item">

@ -206,8 +206,8 @@
<div class="cli-dim">{{ pl.total_area }}</div>
{% endif %}
<div class="cli-place">
<a href="/places/country/{{ pl.country.url }}/">{{ pl.country }}</a>, <a href="places/city/{{ pl.city.url }}/">{{ pl.city }}</a>,
<a href="{{ pl.get_permanent_url }}">{{ pl.adress }}</a>
<a href="/places/country/{{ pl.country.url }}/">{{ pl.country }}</a>, <a href="/places/city/{{ pl.city.url }}/">{{ pl.city }}</a>,
{{ pl.adress }}
</div>
</div>
</div>

Loading…
Cancel
Save