Big import commit. Refactoring. Debuging

remotes/origin/1203
Назар Котюк 11 years ago
parent 369639b324
commit 09e78a6d38
  1. 40
      article/forms.py
  2. 12
      article/urls.py
  3. 6
      city/models.py
  4. 5
      company/search_indexes.py
  5. 218
      conference/management/commands/conf_old.py
  6. 14
      conference/models.py
  7. 29
      conference/search_indexes.py
  8. 10
      country/models.py
  9. 103
      exposition/management/commands/expo_old.py
  10. 20
      exposition/management/commands/test.py
  11. 15
      exposition/models.py
  12. 5
      exposition/search_indexes.py
  13. 129
      exposition/urls.py
  14. 8
      exposition/views.py
  15. 50
      functions/cache_mixin.py
  16. 2
      functions/form_check.py
  17. 5
      functions/model_mixin.py
  18. 18
      functions/models_methods.py
  19. 13
      functions/search_forms.py
  20. 13
      functions/translate.py
  21. 11
      import_xls/admin.py
  22. 3
      import_xls/admin_urls.py
  23. 10
      import_xls/export_forms.py
  24. 13
      meta/admin.py
  25. 3
      place_exposition/urls.py
  26. 3
      place_exposition/views.py
  27. 103
      proj/settings.py
  28. 64
      proj/urls.py
  29. 7
      service/forms.py
  30. 5
      service/models.py
  31. 6
      service/order_forms.py
  32. 7
      service/views.py
  33. 28
      settings/conference_old_urls.py
  34. 1
      settings/management/__init__.py
  35. 1
      settings/management/commands/__init__.py
  36. 22
      settings/management/commands/update_views_cache.py
  37. 79
      settings/old_urls.py
  38. 97
      settings/redirect_views.py
  39. 39
      templates/admin/service/service_add.html
  40. 30
      templates/client/exposition/exposition_by.html
  41. 14
      templates/client/includes/conference/conference_object.html
  42. 12
      templates/client/includes/conference/conference_services.html
  43. 4
      templates/client/includes/event_steps.html
  44. 114
      templates/client/includes/exposition/statistic.html
  45. 23
      templates/client/includes/place/place_object.html
  46. 199
      templates/client/service/build_stand.html
  47. 70
      templates/debug_toolbar/base.html
  48. 69
      templates/debug_toolbar/panels/cache.html
  49. 60
      templates/debug_toolbar/panels/headers.html
  50. 28
      templates/debug_toolbar/panels/logging.html
  51. 37
      templates/debug_toolbar/panels/profiling.html
  52. 124
      templates/debug_toolbar/panels/request.html
  53. 17
      templates/debug_toolbar/panels/settings.html
  54. 19
      templates/debug_toolbar/panels/signals.html
  55. 95
      templates/debug_toolbar/panels/sql.html
  56. 37
      templates/debug_toolbar/panels/sql_explain.html
  57. 44
      templates/debug_toolbar/panels/sql_profile.html
  58. 41
      templates/debug_toolbar/panels/sql_select.html
  59. 57
      templates/debug_toolbar/panels/staticfiles.html
  60. 14
      templates/debug_toolbar/panels/template_source.html
  61. 46
      templates/debug_toolbar/panels/templates.html
  62. 44
      templates/debug_toolbar/panels/timer.html
  63. 17
      templates/debug_toolbar/panels/versions.html
  64. 16
      templates/debug_toolbar/redirect.html
  65. 2
      templates/registration/activation_complete.html
  66. 3
      templates/registration/activation_email_subject.txt
  67. 52
      theme/management/commands/old_urls.py
  68. 4
      theme/models.py

@ -229,7 +229,45 @@ class BlogForm(forms.ModelForm):
widget=forms.TextInput(attrs={'style':'width: 550px'}))
"""
class ArticleFilterForm(forms.Form):
theme = forms.MultipleChoiceField(label=_(u'Тематика:'), required=False,
choices=[(item.id, item.name) for item in Theme.objects.language().all()])
tag = forms.CharField(label=_(u'Теги:'), widget=forms.HiddenInput(), required=False)
tag = forms.CharField(label=_(u'Теги:'), widget=forms.HiddenInput(), required=False)
'''
def __init__(self, *args, **kwargs):
"""
create dynamical translated fields fields
"""
super(ArticleFilterForm, self).__init__(*args, **kwargs)
ids = [item['theme_id'] for item in list(Article.objects.blogs().values('theme_id').distinct())]
self.fields['theme'] = forms.MultipleChoiceField(label=_(u'Тематика:'), required=False,
choices=[(item.id, item.name) for item in Theme.objects.language().filter(id__in=ids)])
'''
class BlogFilterForm(forms.Form):
tag = forms.CharField(label=_(u'Теги:'), widget=forms.HiddenInput(), required=False)
def __init__(self, *args, **kwargs):
"""
create dynamical translated fields fields
"""
super(BlogFilterForm, self).__init__(*args, **kwargs)
ids = [item['theme'] for item in list(Article.objects.blogs().values('theme').distinct())]
self.fields['theme'] = forms.MultipleChoiceField(label=_(u'Тематика:'), required=False,
choices=[(item.id, item.name) for item in Theme.objects.language().filter(id__in=ids)])
class NewsFilterForm(forms.Form):
tag = forms.CharField(label=_(u'Теги:'), widget=forms.HiddenInput(), required=False)
def __init__(self, *args, **kwargs):
"""
create dynamical translated fields fields
"""
super(NewsFilterForm, self).__init__(*args, **kwargs)
ids = [item['theme'] for item in list(Article.objects.news().values('theme').distinct())]
self.fields['theme'] = forms.MultipleChoiceField(label=_(u'Тематика:'), required=False,
choices=[(item.id, item.name) for item in Theme.objects.language().filter(id__in=ids)])

@ -3,10 +3,10 @@ from django.conf.urls import patterns, url
from views import BlogList, NewsList, BlogDetail, NewsDetail
urlpatterns = patterns('',
url(r'blogs/page/(?P<page>\d+)/$', BlogList.as_view()),
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(), {'meta_id':19}),
url(r'news/(?P<slug>.*)/$', NewsDetail.as_view(), {'meta_id':19}),
url(r'^blogs/page/(?P<page>\d+)/$', BlogList.as_view()),
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(), {'meta_id':19}),
url(r'^news/(?P<slug>.*)/$', NewsDetail.as_view(), {'meta_id':19}),
)

@ -17,7 +17,7 @@ from webinar.models import Webinar
# custom functions
from functions.db import db_table_exists
from functions.signal_handlers import post_save_handler
from functions.models_methods import ExpoManager
from functions.models_methods import ExpoManager, CityManager
#check if table exist and create flags if true
flags = [str(item.url) for item in Service.objects.all()] if db_table_exists('service_service') else []
@ -31,6 +31,7 @@ class City(TranslatableModel):
"""
objects = ExpoManager()
used = CityManager()
catalog = '/city/'
services = BitField(flags=flags)
@ -62,6 +63,9 @@ class City(TranslatableModel):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
class Meta:
ordering = ['translations__name']
def __unicode__(self):
return self.lazy_translation_getter('name', self.pk)

@ -35,4 +35,7 @@ class CompanyExpositionIndex(indexes.SearchIndex, indexes.Indexable, ExpoSearchM
def index_queryset(self, using=None):
return self.get_model().objects.filter()
return self.get_model().objects.filter()
def get_updated_field(self):
return 'modified'

@ -0,0 +1,218 @@
# -*- coding: utf-8 -*-
import os
import MySQLdb
from MySQLdb.cursors import DictCursor
from django.core.management.base import BaseCommand
from django.conf import settings
from conference.models import Conference
from django.core.files import File
from functions.translate import fill_with_signal
from country.models import Country
from city.models import City
class Command(BaseCommand):
def handle(self, *args, **options):
db = MySQLdb.connect(host="localhost",
user="expomap",
passwd="7FbLtAGjse",
db="old_db",
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
sql = """
SELECT products.products_id as id, products_date_added as created, products_last_modified as modified,
discount, expohit, ufi, products_name as name, products_description as description,
products_short_description as main_title, products_viewed as viewed, products_period as period,
products_org as organiser,products_products as products, products_official as web_page,
products_img1 as logo, products_startdate as data_begin, products_enddate as data_end,
url as old_url, places_id
FROM `products`
LEFT JOIN `products_description` ON products.products_id=products_description.products_id
WHERE `products_status` =1
AND `conference` =1 AND places_id >0
"""
cursor.execute(sql)
result = cursor.fetchall()
names = [item['name'] for item in result]
media = settings.MEDIA_ROOT.replace('media/', '')
for i, item in enumerate(result):
name = item['name']
print('number: %d, name: %s'%(i, name.encode('utf8')))
if Conference.objects.filter(translations__name=name).exists():
continue
data_begin = item['data_begin']
data_end= item['data_end']
place_id = item['places_id'] # convert to country and city
country, city = get_places(place_id)
#if isinstance(city, unicode):
#print(city.encode('utf8'))
# value = bad_cities.get(city)
# if value:
# bad_cities[city] = value + 1
# else:
# bad_cities[city] = 1
# counter += 1
# continue
if not country or not city:
continue
old_url = item['old_url']
periodic = item['period']
periodic = get_periodic(periodic)
web_page = item['web_page']
currency = 'USD'
expohit = item['expohit']
ufi = item['ufi']
if ufi:
ufi = 1
else:
ufi = 0
created = item['created']
modified = item['modified']
data = {'name_ru': name, 'main_title_ru': item['main_title'], 'description_ru': item['description'],
'main_themes_ru': item['products'], 'time_ru': '', 'discount_description_ru': '', 'title_ru': '',
'descriptions_ru': '', 'keywords_ru': ''}
conference = Conference(data_begin=data_begin, data_end=data_end, city=city, country=country,
web_page=web_page, old_url=old_url, periodic=periodic, currency=currency,
expohit=expohit, created=created, modified=modified)
try:
fill_with_signal(Conference, conference, data)
except:
continue
print('conference: %s'%str(conference))
#print(len(bad_cities.keys()))
#print(len(result))
#print(Conference.objects.filter().count())
#print(Conference.objects.exclude(translations__name__in=names).count())
def get_periodic(value):
PERIODIC = {u'Ежегодно': 1.0, u'Раз в 2 года': 0.5, u'2 раза в год': 2.0, u'4 раза в год': 4.0,
u'3 раза в год': 3.0, u'Раз в 3 года': 0.33, u'Раз в 4 года': 0.25, u'5 раз в год': 5.0,
u'Раз в два года': 0.5, u'Три раза в год': 3.0}
return PERIODIC.get(value, 0)
def get_logo(value):
if not value:
return None
if value.startswith('..'):
value = value.replace('..', 'media')
elif value.startswith('/'):
value = 'media'+value
return value
def get_places(place_id):
db = MySQLdb.connect(host="localhost",
user="expomap",
passwd="7FbLtAGjse",
db="old_db",
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
sql_city = """
SELECT title as city_name, url as city_old_url, inflect as city_inflect, parent_id as country_id
FROM `products_places`
WHERE `places_id` =%s
"""%place_id
cursor.execute(sql_city)
result = cursor.fetchone()
city_name, city_old_url, city_inflect = result['city_name'], result['city_old_url'], result['city_inflect']
country_id = result['country_id']
if city_name:
city_name = city_name.strip()
if city_name==u'Гонконг':
country = Country.objects.get(id=76)
city = City.objects.get(url='hong-kong')
return (country, city)
sql_country = """
SELECT title as country_name, url as country_old_url, inflect as country_inflect
FROM `products_places`
WHERE `places_id` =%s
"""%country_id
cursor.execute(sql_country)
result = cursor.fetchone()
country_name, country_old_url, country_inflect = result['country_name'], result['country_old_url'], result['country_inflect']
country_name = filter_country(country_name)
try:
country = Country.objects.get(translations__name=country_name)
except Country.DoesNotExist:
country = None
except Country.MultipleObjectsReturned:
country = Country.objects.filter(translations__name=country_name)[0]
city_name = filter_city(city_name)
try:
city = City.objects.get(translations__name=city_name, country=country)
except City.DoesNotExist:
#city = city_name
city = None
#print(city_name.encode('utf8'))
except City.MultipleObjectsReturned:
city = City.objects.filter(translations__name=city_name, country=country)[0]
#print('----------------')
#print(city_name.encode('utf8'))
#print('----------------')
return (country, city)
def filter_country(name):
if name == u'ЮАР':
name = u'Южно-Африканская Республика'
elif name == u'Танзания':
name = u'Объединенная Республика Танзания'
elif name == u'Гавайи':
name = u'США'
elif name == u'Бирма':
name = u'Мьянма'
elif name == u'Босния и Герцоговина':
name = u'Босния и Герцеговина'
return name
def filter_city(name):
cities = {u'Дели': u'Нью-Дели', u'Дэли': u'Нью-Дели', u'Пуна': u'Пуне', u'Лонг-Бич': u'Лонг Бич',
u'Калифорния': u'Лос-Анджелес', u'Санта-Клара': u'Санта Клара', u'Скотсдейл': u'Скоттсдейл',
u'Пенанг': u'Пинанг', u'Лейк Буэна Виста': u'Лейк-Буэна-Виста', u'Лиллестрём': u'Лиллештром',
u'Хертогенбош': u'Ден Бош', u'Марбелла': u'Марбелья', u'Лилль': u'Лилль', u'Ла Рош-сюр-Форон': u'Ла-Рош-сюр-Форон',
u'Эль-Кувейт': u'Кувейт', u'Харрогит': u'Харрогейт', u'Иокогама': u'Йокогама', u'Палм Бич': u'Палм-Бич',
u'Фрайбург': u'Фрейбург в Брейсгау', u'Колмар': u'Кольмар', u'Мускат': u'Маскат', u'Бад Зальцуфлен': u'Бад-Зальцуфлен'}
new_name = cities.get(name)
if new_name:
return new_name
else:
return name
"""
# convert logo
logo = item['logo']
logo = get_logo(logo)
if logo and logo.startswith('media/images'):
file = media + logo
if os.path.isfile(file):
f = open('mytest.pdf')
else:
logo = None
"""

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from django.db import models
from django.db.models import Q
from django.db.models.signals import post_save, pre_save
from django.contrib.contenttypes import generic
from exposition.manager import ClientManager
@ -19,7 +20,7 @@ from functions.model_mixin import EventMixin, ExpoMixin
from functions.models_methods import hvad_to_dict
# check if table exist and create flags if true
flags = [str(item.id) for item in Service.objects.all()] if db_table_exists('service_service') else []
flags = [item.url for item in Service.objects.all()] if db_table_exists('service_service') else []
from django.conf import settings
CURRENCY = settings.CURRENCY
@ -40,6 +41,7 @@ class Conference(TranslatableModel, EventMixin, ExpoMixin):
enable = ClientManager()
url = models.SlugField(unique=True, max_length=255)
old_url = models.SlugField(unique=True, max_length=255)
data_begin = models.DateField(verbose_name='Дата начала')
data_end = models.DateField(verbose_name='Дата окончания')
services = BitField(flags=flags)
@ -116,6 +118,16 @@ class Conference(TranslatableModel, EventMixin, ExpoMixin):
def __unicode__(self):
return self.lazy_translation_getter('name', unicode(self.pk))
def get_services(self):
country_ids = [item for item, bool in self.country.services if bool==True]
ids = [item for item, bool in self.services if bool==True]
qs = Service.objects.filter(Q(Q(url__in=country_ids) & Q(type=Service.type.conference)) | Q(url__in=ids))
return list(qs)
#return list(Service.objects.language().filter(url__in=ids, type=Service.type.conference).order_by('sort'))
def get_nearest_events(self):
conferences = Conference.objects.all()[:5]
return conferences

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from haystack import indexes
from models import Conference
@ -5,6 +6,32 @@ from models import Conference
class ConferenceIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
where = indexes.MultiValueField()
url = indexes.CharField()
data_begin = indexes.DateField(model_attr='data_begin')
data_end = indexes.DateField(model_attr='data_end')
theme = indexes.MultiValueField()
tag = indexes.MultiValueField()
country_id = indexes.IntegerField()
city_id = indexes.IntegerField()
area_id = indexes.IntegerField()
content_auto = indexes.EdgeNgramField()
form_name = indexes.CharField()
# translated fields
name_en = indexes.CharField()
name_ru = indexes.CharField()
catalog_name_en = indexes.CharField()
catalog_name_ru = indexes.CharField()
def prepare_form_name(self, obj):
return None
def prepare_catalog_name_en(self, obj):
return u'Conferences'
def prepare_catalog_name_ru(self, obj):
return u'Конференции'
def prepare_where(self, obj):
country = [tr.name for tr in obj.country.translations.all()]
city = [tr.name for tr in obj.city.translations.all()]
@ -18,3 +45,5 @@ class ConferenceIndex(indexes.SearchIndex, indexes.Indexable):
return self.get_model().objects.filter(is_published=True)
def get_updated_field(self):
return "modified"

@ -40,6 +40,11 @@ class CountryManager(TranslationManager):
except:
return None
def expo_countries(self):
countries_id = [item['country_id'] for item in Exposition.objects.values('country_id').distinct()]
return self.language().filter(id__in=countries_id)
class AreaManager(TranslationManager):
def all_sorted(self):
"""
@ -92,6 +97,7 @@ class Country(TranslatableModel):
"""
objects = CountryManager()
used = CountryManager()
catalog = '/country/'
services = BitField(flags=flags)
@ -138,8 +144,8 @@ class Country(TranslatableModel):
)
country_code = models.CharField(max_length=2)
# class Meta:
# ordering = ['translations__name']
class Meta:
ordering = ['translations__name']
def __unicode__(self):
return self.lazy_translation_getter('name', unicode(self.pk))

@ -0,0 +1,103 @@
# -*- coding: utf-8 -*-
import os
import MySQLdb
from MySQLdb.cursors import DictCursor
from django.core.management.base import BaseCommand
from django.conf import settings
from exposition.models import Exposition
from conference.management.commands.conf_old import filter_city, filter_country, get_periodic, get_logo, get_places
from django.core.files import File
from functions.translate import fill_with_signal
from country.models import Country
from city.models import City
file_path = settings.MEDIA_ROOT + 'exposition/bad_expos.txt'
class Command(BaseCommand):
def handle(self, *args, **options):
db = MySQLdb.connect(host="localhost",
user="expomap",
passwd="7FbLtAGjse",
db="old_db",
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
sql = """
SELECT products.products_id as id, products_date_added as created, products_last_modified as modified,
discount, expohit, ufi, products_name as name, products_description as description,
products_short_description as main_title, products_viewed as viewed, products_period as period,
products_org as organiser,products_products as products, products_official as web_page,
products_img1 as logo, products_startdate as data_begin, products_enddate as data_end,
url as old_url, places_id
FROM `products`
LEFT JOIN `products_description` ON products.products_id=products_description.products_id
WHERE `products_status` =1
AND `conference` =0 AND places_id >0
"""
cursor.execute(sql)
result = cursor.fetchall()
names = [item['name'] for item in result]
#media = settings.MEDIA_ROOT.replace('media/', '')
#counter = 0
#bad_cities = {}
bad_expos = []
for i, item in enumerate(result):
print('number: %d, errors: %d'%(i, len(bad_expos)))
name = item['name']
if Exposition.objects.filter(translations__name=name).exists():
msg = u'%s|||%s|||%s'%(name, item['old_url'], 'already exist')
bad_expos.append(msg)
continue
data_begin = item['data_begin']
data_end= item['data_end']
place_id = item['places_id'] # convert to country and city
country, city = get_places(place_id)
if not country or not city:
msg = u'%s|||%s|||%s'%(name, item['old_url'], 'bad country or city')
bad_expos.append(msg)
continue
old_url = item['old_url']
periodic = item['period']
periodic = get_periodic(periodic)
web_page = item['web_page']
currency = 'USD'
expohit = item['expohit']
ufi = item['ufi']
if ufi:
ufi = 1
else:
ufi = 0
created = item['created']
modified = item['modified']
data = {'name_ru': name, 'main_title_ru': item['main_title'], 'description_ru': item['description'],
'products_ru': item['products'], 'discount_description_ru': '', 'time_ru': '', 'price_day_ru':'',
'price_all_ru': '', 'price_day_bar_ru': '', 'price_all_bar_ru': '', 'stat_countries_ru': '',
'pre_condition_ru':'', 'stand_condition_ru': '', 'visit_note_ru': '', 'participation_note_ru': '',
'title_ru': '', 'descriptions_ru': '', 'keywords_ru': ''}
exposition = Exposition(data_begin=data_begin, data_end=data_end, city=city, country=country,
web_page=web_page, old_url=old_url, periodic=periodic, currency=currency,
expohit=expohit, created=created, modified=modified, quality_label=ufi)
try:
fill_with_signal(Exposition, exposition, data)
except Exception as e:
msg = u'%s|||%s|||%s'%(name, item['old_url'], str(e))
bad_expos.append(msg)
continue
print('saving file')
file = open(file_path, 'w')
for item in bad_expos:
file.write("%s\n" % item)
file.close()

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from meta.models import MetaSetting
class Command(BaseCommand):
def handle(self, *args, **options):
a = MetaSetting.objects.filter(translations__h1__contains='«').count()
qs = MetaSetting.objects.language('ru').all()
for item in qs:
item.title = item.title.replace(u'«', u'').replace(u'»', u'')
item.description = item.title.replace(u'«', u'').replace(u'»', u'')
item.h1 = item.h1.replace(u'«', u'').replace(u'»', u'')
#item.save()

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import copy, datetime
from django.db import models
from django.db.models import Q
from django.db.models.signals import post_save, pre_save
from django.utils.translation import ugettext as _
from django.utils import translation
@ -36,7 +37,7 @@ BIT_AUDIENCE = settings.BIT_AUDIENCE
CURRENCY = settings.CURRENCY
# check if table exist and create flags if true
flags = [str(item.id) for item in Service.objects.all()] if db_table_exists('service_service') else []
flags = [item.url for item in Service.objects.all()] if db_table_exists('service_service') else []
class Exposition(TranslatableModel, EventMixin, ExpoMixin):
@ -53,6 +54,7 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
event_type = 'expo'
url = models.SlugField(unique=True, max_length=255)
old_url = models.SlugField(unique=True, max_length=255)
data_begin = models.DateField(verbose_name='Дата начала')
data_end = models.DateField(verbose_name='Дата окончания')
services = BitField(flags=flags)
@ -162,6 +164,15 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
def __unicode__(self):
return self.lazy_translation_getter('name', unicode(self.pk))
def get_services(self):
country_ids = [item for item, bool in self.country.services if bool==True]
ids = [item for item, bool in self.services if bool==True]
qs = Service.objects.filter(Q(Q(url__in=country_ids) & Q(type=Service.type.expo)) | Q(url__in=ids))
return list(qs)
def get_parent(self):
return {}
@ -232,7 +243,7 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
for k, v in BIT_AUDIENCE:
for item in checked:
if item == k:
audience.append(v)
audience.append(unicode(v))
return ', '.join(audience)

@ -48,4 +48,7 @@ class ExpositionIndex(indexes.SearchIndex, indexes.Indexable, ExpoSearchMixin):
elif lang=='en':
return self.name_en
else:
return self.name_ru
return self.name_ru
def get_updated_field(self):
return 'modified'

@ -4,87 +4,80 @@ from views import ExpositionStatistic, ExpositionPrice,\
ExpositionProgramme, ExpositionSearchView, ExpositionByCountry, ExpositionByTheme, ExpositionByCity
from django.http import HttpResponse
from django.views.decorators.cache import cache_page
from views import ExpositionServiceView
from views import ExpoCountryCatalog, ExpoCityCatalog, ExpoThemeCatalog, ExpoTagCatalog, ExpoList, ExpoDetail,\
ExpoVisitors, ExpoMembers
urlpatterns = patterns('',
url(r'expo/add-note/(?P<slug>.*)/$', 'exposition.views.add_note'),
url(r'exposition-add-calendar/(?P<id>\d+)/$', 'exposition.views.exposition_add_calendar'),
url(r'exposition-visit/(?P<id>\d+)/$', 'exposition.views.exposition_visit'),
url(r'^expo/add-note/(?P<slug>.*)/$', 'exposition.views.add_note'),
url(r'^exposition-add-calendar/(?P<id>\d+)/$', 'exposition.views.exposition_add_calendar'),
url(r'^exposition-visit/(?P<id>\d+)/$', 'exposition.views.exposition_visit'),
# search
url(r'expo/search/', ExpositionSearchView.as_view()),
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(), {'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/$', ExpositionByCountry.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(), {'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/$', ExpositionByCity.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(), {'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}),
url(r'^expo/theme/$', ExpositionByTheme.as_view()),
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+)/(?P<month>.*)/$', 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+)/$', 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>.*)/$', 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>.*)/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(), {'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>.*)/statistic/$', ExpositionStatistic.as_view()),
url(r'expo/(?P<slug>.*)/price/$', ExpositionPrice.as_view()),
url(r'expo/(?P<slug>.*)/program/$', ExpositionProgramme.as_view()),
url(r'expo/(?P<slug>.*)/visitors/page/(?P<page>\d+)/$', ExpoVisitors.as_view()),
url(r'expo/(?P<slug>.*)/visitors/$', ExpoVisitors.as_view()),
url(r'expo/(?P<slug>.*)/members/page/(?P<page>\d+)/$', ExpoMembers.as_view()),
url(r'expo/(?P<slug>.*)/members/$', ExpoMembers.as_view()),
url(r'expo/(?P<slug>.*)/service/(?P<service_url>.*)/', ExpositionServiceView.as_view()),
url(r'^expo/(?P<slug>.*)/statistic/$', ExpositionStatistic.as_view()),
url(r'^expo/(?P<slug>.*)/price/$', ExpositionPrice.as_view()),
url(r'^expo/(?P<slug>.*)/program/$', ExpositionProgramme.as_view()),
url(r'^expo/(?P<slug>.*)/visitors/page/(?P<page>\d+)/$', ExpoVisitors.as_view()),
url(r'^expo/(?P<slug>.*)/visitors/$', ExpoVisitors.as_view()),
url(r'^expo/(?P<slug>.*)/members/page/(?P<page>\d+)/$', ExpoMembers.as_view()),
url(r'^expo/(?P<slug>.*)/members/$', ExpoMembers.as_view()),
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+)/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}),
url(r'expo/page/(?P<page>\d+)/$', ExpoList.as_view(), {'meta_id':2}),
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}),
url(r'^expo/page/(?P<page>\d+)/$', ExpoList.as_view(), {'meta_id':2}),
# expo page
url(r'expo/(?P<slug>.*)/$', ExpoDetail.as_view(), {'meta_id':18}),# event
url(r'expo/$', ExpoList.as_view(), {'meta_id':2}),
#url(r'expo/(?P<slug>.*)/service/(?P<url>.*)/$', ExpositionServiceView.as_view()),
#url(r'expo/(?P<params>.*)/service/(?P<url>.*)/$', ExpositionServiceView.as_view()),
#url(r'expo/(?P<params>.*)/statistic/$', ExpositionStatistic.as_view()),
url(r'^expo/(?P<slug>.*)/$', ExpoDetail.as_view(), {'meta_id':18}),# event
url(r'^expo/$', ExpoList.as_view() , {'meta_id':2}),
)

@ -68,13 +68,19 @@ class ExpositionByTheme(ExpositionBy):
.order_by('translations__name').distinct()
class ExpositionByCity(ExpositionBy):
from functions.cache_mixin import CacheMixin
class ExpositionByCity(CacheMixin, ExpositionBy):
cache_timeout = 60
model = City
title1 = _(u'По городам')
title2 = _(u'Выставки мира по городам')
catalog = 'city/'
def get_queryset(self):
#cities_id = [item['city_id'] for item in Exposition.objects.values('city_id').distinct()]
#return self.model.objects.language().filter(id__in=cities_id).order_by('translations__name').distinct()
lang = translation.get_language()
return self.model.objects.select_related('exposition_city')\
.filter(exposition_city__city__isnull=False, translations__language_code=lang)\

@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
import random
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)
def dispatch(self, *args, **kwargs):
return super(NeverCacheMixin, self).dispatch(*args, **kwargs)
class LoginRequiredMixin(object):
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(LoginRequiredMixin, self).dispatch(*args, **kwargs)
class CacheMixin(object):
cache_timeout = 60
def get_cache_timeout(self):
return self.cache_timeout
def dispatch(self, *args, **kwargs):
return cache_page(self.get_cache_timeout())(super(CacheMixin, self).dispatch)(*args, **kwargs)
class CacheControlMixin(object):
cache_timeout = 60
def get_cache_timeout(self):
return self.cache_timeout
def dispatch(self, *args, **kwargs):
response = super(CacheControlMixin, self).dispatch(*args, **kwargs)
patch_response_headers(response, self.get_cache_timeout())
return response
class JitterCacheMixin(CacheControlMixin):
cache_range = [60, 120]
def get_cache_range(self):
return self.cache_range
def get_cache_timeout(self):
return random.randint(*self.get_cache_range())

@ -20,7 +20,7 @@ from slugify import slugify
def translit_with_separator(string, separator='-'):
return slugify(string, to_lower=True)
#return slugify(string)
"""
Trsanslit string and replace "bad" symbols for separator

@ -77,8 +77,9 @@ class EventMixin(object):
def get_services(self):
ids = [item for item, bool in self.country.services if bool==True]
##sasa
country_ids = [item for item, bool in self.country.services if bool==True]
ids = [item for item, bool in self.services if bool==True and item in country_ids]
return list(Service.objects.language().filter(url__in=ids).order_by('sort'))
def duration_days(self, month=None):

@ -1,6 +1,9 @@
from django.utils.translation import get_language
from django.db.models import Q
from hvad.models import TranslationManager
class ExpoManager(TranslationManager):
def all(self, lang=None):
if lang:
@ -15,6 +18,21 @@ class ExpoManager(TranslationManager):
except:
return None
class CityManager(TranslationManager):
def all(self):
lang = get_language()
qs = super(CityManager, self).select_related('exposition_city', 'conference_city')
qs = qs.filter(Q(exposition_city__city__isnull=False) | Q(conference_city__city__isnull=False))\
.order_by('translations__name').distinct()
return qs
def expo_cities(self):
from exposition.models import Exposition
cities_id = [item['city_id'] for item in Exposition.objects.values('city_id').distinct()]
return self.language().filter(id__in=cities_id)
def hvad_to_dict(object):
"""

@ -239,15 +239,10 @@ class ExpositionSearchForm(AbstactSearchForm):
#tg = forms.CharField(label=_(u'Теги'), required=False, widget=forms.CheckboxSelectMultiple())
area = forms.MultipleChoiceField(label=_(u'Регион'),
choices=[(item.id, item.name) for item in Area.objects.\
select_related('country', 'country__exposition_country').\
filter(country__exposition_country__country__isnull=False).\
distinct()],
choices=[(item.id, item.name) for item in Area.objects.language().all()],
required=False, widget=forms.CheckboxSelectMultiple())
co = forms.MultipleChoiceField(label=_(u'Страна'), required=False, widget=forms.CheckboxSelectMultiple(),
choices=[(item.id, item.name) for item in Country.objects.select_related('exposition_country')\
.filter(exposition_country__country__isnull=False, translations__language_code=translation.get_language())\
.order_by('translations__name').distinct()]
choices=[(item.id, item.name) for item in Country.objects.expo_countries()]
)
ci = forms.MultipleChoiceField(label=_(u'Город'), required=False, widget=forms.CheckboxSelectMultiple(),
@ -334,9 +329,7 @@ class PlaceSearchForm(AbstactSearchForm):
area = forms.MultipleChoiceField(label=_(u'Регион'), choices=[(item.id, item.name) for item in Area.objects.all_sorted()],
required=False, widget=forms.CheckboxSelectMultiple())
co = forms.MultipleChoiceField(label=_(u'Страна'), required=False, widget=forms.CheckboxSelectMultiple(),
choices=[(item.id, item.name) for item in Country.objects.select_related('exposition_country')\
.filter(exposition_country__country__isnull=False, translations__language_code=translation.get_language())\
.order_by('translations__name').distinct()]
choices=[(item.id, item.name) for item in Country.objects.expo_countries()]
)
ci = forms.MultipleChoiceField(label=_(u'Город'), required=False, widget=forms.CheckboxSelectMultiple(),

@ -101,20 +101,27 @@ def fill_with_signal(model, obj, data):
# translated fields
fields = [field.name for field in model.translations.related.editable_fields() if field.name not in bad_fields]
# translate to first language(require)
# ! first save method call signal that fill require language to all translated fields
if not obj.id:
# new object
obj.translate(all_langs[0])
# go through all fields and set value
for field in fields:
setattr(obj, field, data.get('%s_%s'%(field, all_langs[0])).strip())
value = data.get('%s_%s'%(field, all_langs[0]), '')
if value:
setattr(obj, field, value.strip())
obj.save()
else:
trans_obj = model._meta.translations_model.objects.get(language_code = all_langs[0],
master__id=getattr(obj, 'id'))
for field in fields:
setattr(trans_obj, field, data.get('%s_%s'%(field, all_langs[0])).strip())
value = data.get('%s_%s'%(field, all_langs[0]), '')
if value:
setattr(trans_obj, field, value.strip())
trans_obj.save()
@ -126,7 +133,7 @@ def fill_with_signal(model, obj, data):
# start from second language
trans_obj = model._meta.translations_model.objects.get(language_code = code,master__id=getattr(obj, 'id'))
for field in fields:
val = data.get('%s_%s'%(field, code)).strip()
val = data.get('%s_%s'%(field, code), '').strip()
if val == '':
# get value from require translation
setattr(trans_obj, field, getattr(require_transl, field))

@ -11,7 +11,8 @@ import xlrd
from import_forms import ImportEventForm, ImportThemeForm, ImportTagForm, ImportOrganiserForm,\
ImportPlaceConferenceForm, ImportPlaceExpositionForm
from export_forms import ExportEventForm, ExportOrganiserForm, ExportThemeForm, ExportTagForm,\
ExportUserForm, ExportCompanyForm, ExportPlaceConferenceForm, ExportPlaceExpositionForm, ExportBlogForm
ExportUserForm, ExportCompanyForm, ExportPlaceConferenceForm, ExportPlaceExpositionForm, ExportBlogForm,\
ExportCityForm
from django.views.generic import FormView
from django.contrib import messages
@ -82,6 +83,14 @@ class ExportBlog(ExportView):
form_class = ExportBlogForm
success_url = '/admin/export-blog/'
class ExportBlog(ExportView):
form_class = ExportBlogForm
success_url = '/admin/export-blog/'
class ExportCity(ExportView):
form_class = ExportCityForm
success_url = '/admin/export-city/'
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, ExportBlog
ExportPlaceConference, ExportCompany, ExportUser, ExportBlog, ExportCity
urlpatterns = patterns('',
url(r'^import-event/$', ImportEvent.as_view()),
@ -22,5 +22,6 @@ urlpatterns = patterns('',
url(r'^export-user/$', ExportUser.as_view()),
url(r'^export-company/$', ExportCompany.as_view()),
url(r'^export-blog/$', ExportBlog.as_view()),
url(r'^export-city/$', ExportCity.as_view()),
)

@ -4,6 +4,7 @@ from django.conf import settings
from django.utils import translation
from theme.models import Theme, Tag
from country.models import Country
from city.models import City
from organiser.models import Organiser
from accounts.models import User
from company.models import Company
@ -161,6 +162,15 @@ class ExportBlogForm(ExportForm):
translation.activate(data['language'])
return self.model.objects.blogs()
class ExportCityForm(ExportForm):
model = City
def get_fname(self):
return 'cities.xls'
def get_objects(self, data):
translation.activate(data['language'])
return self.model.used.all()
class ExportEventForm(forms.Form):

@ -10,18 +10,7 @@ from django.contrib.auth.decorators import login_required
#models and forms
from models import MetaSetting
from forms import MetaForm, MetaFilterForm
from theme.models import Tag
from city.models import City
from file.models import FileModel, TmpFile
from file.forms import FileModelForm, FileForm
from photologue.forms import PhotoForm
#python
import random
#custom views
from functions.custom_views import objects_list, delete_object
from functions.views_help import get_referer
from functions.admin_views import AdminListView, AdminView, upload_photo
from functions.admin_views import AdminListView, AdminView

@ -20,7 +20,8 @@ urlpatterns = patterns('',
url(r'(?P<slug>.*)/photo/page/(?P<page>\d+)/$', PlacePhoto.as_view()),
url(r'(?P<slug>.*)/photo/$', PlacePhoto.as_view()),
#url(r'expo/(?P<slug>.*)/service/(?P<url>.*)/$', ExpositionServiceView.as_view()),
url(r'(?P<slug>.*)/$', PlaceDetail.as_view()),
url(r'page/(?P<page>\d+)/$', PlaceList.as_view()),
url(r'(?P<slug>.*)/$', PlaceDetail.as_view()),
url(r'$', PlaceList.as_view()),
)

@ -127,8 +127,7 @@ class PlaceList(ListView):
def get_queryset(self):
lang = translation.get_language()
qs = super(PlaceList, self).get_queryset().filter(language_code=lang).order_by('-rating')
qs = super(PlaceList, self).get_queryset().order_by('-rating')
conf_qs = PlaceConference.objects.language().all()
return list(qs)+list(conf_qs)

@ -27,14 +27,17 @@ DATABASES = {
}
}
'''
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
'LOCATION': '127.0.0.1:11211',
"default": {
"BACKEND": "redis_cache.cache.RedisCache",
"LOCATION": "127.0.0.1:6379:1",
"OPTIONS": {
"CLIENT_CLASS": "redis_cache.client.DefaultClient",
},
}
}
'''
# Hosts/domain names that are valid for this site; required if DEBUG is False
@ -72,10 +75,10 @@ USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
USE_L10N = False
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
USE_TZ = False
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media/')
@ -136,8 +139,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
MIDDLEWARE_CLASSES = (
# 'django.middleware.cache.UpdateCacheMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
@ -149,7 +150,6 @@ MIDDLEWARE_CLASSES = (
# Uncomment the next line for simple clickjacking protection:
'django.middleware.clickjacking.XFrameOptionsMiddleware',
#'debug_toolbar.middleware.DebugToolbarMiddleware',
)
@ -163,7 +163,7 @@ TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(SITE_ROOT, 'templates'),
# os.path.join(SITE_ROOT, 'templates/debug_toolbar'),
os.path.join(SITE_ROOT, 'templates/admin'),
os.path.join(SITE_ROOT, 'templates/admin/accounts'),
os.path.join(SITE_ROOT, 'templates/admin/article'),
@ -191,6 +191,7 @@ TEMPLATE_DIRS = (
os.path.join(SITE_ROOT, 'templates/client/exposition'),
os.path.join(SITE_ROOT, 'templates/client/photoreport'),
os.path.join(SITE_ROOT, 'templates/client/includes'),
os.path.join(SITE_ROOT, 'templates'),
#os.path.join(SITE_ROOT, 'templates/client/popups'),
)
@ -199,21 +200,13 @@ LOGIN_URL='/'
#registration info
ACCOUNT_ACTIVATION_DAYS=2
# mail settings
#EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
#EMAIL_HOST = 'localhost'
#EMAIL_HOST_USER = ''
#EMAIL_HOST_PASSWORD = ''
#EMAIL_USE_TLS = False
#EMAIL_PORT = 25
#test
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'kotzilla'
EMAIL_HOST_USER = 'kotzillla@gmail.com'
EMAIL_HOST_PASSWORD = 'fitteR2006!!'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = 'kotzillla@gmail.com'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = "expomap.ru"
AUTHENTICATION_BACKENDS = (
@ -324,17 +317,11 @@ INSTALLED_APPS = (
'pytils',
'pymorphy',
'password_reset',
#'social_auth',
'django_crontab',
'social.apps.django_app.default',
# 'south',
#'debug_toolbar',
)
INTERNAL_IPS = ('176.121.5.82',)
DEBUG_TOOLBAR_PATCH_SETTINGS = False
#DEBUG_TOOLBAR_PANELS = (
# 'debug_toolbar.panels.profiling.ProfilingPanel',
#)
PYMORPHY_DICTS = {
'ru': { 'dir': os.path.join(SITE_ROOT, 'settings/russian_dicts')} #'/home/www/proj/settings/russian_dicts' },
}
@ -379,7 +366,17 @@ LOGGING = {
}
}
THUMBNAIL_DEBUG = True
CRONJOBS = [
('0 */1 * * *', 'django.core.management.call_command', ['update_index conference --age=1']),
('0 */1 * * *', 'django.core.management.call_command', ['update_index exposition --age=1']),
('0 */12 * * *', 'django.core.management.call_command', ['update_index place_exposition --age=12']),
('0 */24 * * *', 'django.core.management.call_command', ['update_index company --age=24']),
('0 */24 * * *', 'django.core.management.call_command', ['update_index theme --age=24']),
('0 */24 * * *', 'django.core.management.call_command', ['update_index tag --age=24']),
]
THUMBNAIL_DEBUG = DEBUG
CALLBACK_EMAIL = 'kotzilla@ukr.net'
@ -407,3 +404,39 @@ try:
from local import *
except ImportError, e:
pass
# debug_toolbar settings
"""
if DEBUG:
DEBUG_TOOLBAR_PATCH_SETTINGS = False
INTERNAL_IPS = ('127.0.0.1','176.121.5.82', '176.121.11.162', '77.123.47.46')
MIDDLEWARE_CLASSES += (
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
INSTALLED_APPS += (
'debug_toolbar',
)
JQUERY_URL = os.path.join(SITE_ROOT, 'static/client/js/jquery-ui-1.10.4.custom.min.js'),
DEBUG_TOOLBAR_PANELS = [
#'debug_toolbar.panels.versions.VersionsPanel',
#'debug_toolbar.panels.timer.TimerPanel',
#'debug_toolbar.panels.settings.SettingsPanel',
#'debug_toolbar.panels.headers.HeadersPanel',
#'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
#'debug_toolbar.panels.staticfiles.StaticFilesPanel',
#'debug_toolbar.panels.templates.TemplatesPanel',
#'debug_toolbar.panels.cache.CachePanel',
#'debug_toolbar.panels.signals.SignalsPanel',
#'debug_toolbar.panels.logging.LoggingPanel',
#'debug_toolbar.panels.redirects.RedirectsPanel',
]
#DEBUG_TOOLBAR_CONFIG = {
# 'INTERCEPT_REDIRECTS': False,
#}
"""

@ -5,13 +5,14 @@ from core.views import PlaceListView, PlacePhotoView, EventSearchView
from core.simple_index_view import AdvertisingView, AboutView
from views import MainPageView, MainPageViewTest
from place_exposition.views import PlaceSearchView
from django.http import HttpResponse
from django.contrib.sitemaps.views import sitemap
import debug_toolbar
urlpatterns = patterns('',
#url(r'^__debug__/', include(debug_toolbar.urls)),
url(r'^admin/', include('proj.admin_urls')),
url(r'^$', MainPageView.as_view()),
url(r'^main_page/$', MainPageViewTest.as_view()),
@ -20,6 +21,7 @@ urlpatterns = patterns('',
url(r'^', include('accounts.urls')),
url(r'^', include('exposition.urls')),
url(r'^', include('settings.conference_old_urls')), # conference redirects from old version
url(r'^', include('conference.urls')),
url(r'^', include('seminar.urls')),
url(r'^', include('webinar.urls')),
@ -30,76 +32,26 @@ urlpatterns = patterns('',
url(r'^city/', include('city.urls')),
url(r'^organiser/', include('organiser.urls')),
url(r'^gallery/', include('photologue.client_urls')),
url(r'^', include('file.urls')),
url(r'^', include('django_messages.expomap_urls')),
url(r'^messages/', include('django_messages.urls')),
url(r'^advertising/$', AdvertisingView.as_view()),
url(r'^about/$', AboutView.as_view()),
url(r'^partners/$', AboutView.as_view()),
url(r'^contacts/$', AboutView.as_view()),
#url(r'^events/search/$', EventSearchView.as_view()),
#url(r'^places/search/$', PlaceSearchView.as_view()),
#url(r'^places/(?P<params>.*)/photo/(?P<page>\d+)/$', PlacePhotoView.as_view()),
#url(r'^places/(?P<params>.*)/photo/$', PlacePhotoView.as_view()),
#url(r'^places/(?P<params>.*)/(?P<page>\d+)/$', PlaceListView.as_view()),
#url(r'^places/(?P<page>\d+)/$', PlaceListView.as_view()),
#url(r'^places/(?P<params>.*)/$', PlaceListView.as_view()),
#url(r'^places/$', PlaceListView.as_view()),
url(r'^social/', include('social.apps.django_app.urls', namespace='social')),
url(r'^login/', 'registration.backends.default.views.LoginView'),
url(r'^logout/', 'registration.backends.default.views.LogoutView'),
#url(r'^profile/$', 'accounts.views.profile'),
url(r'^accounts/', include('registration.backends.default.urls')),
#url(r'^places/$', 'place_exposition.views.catalog'),
#url(r'^places/(?P<url>.*)/(?P<photo>photo)', 'place_exposition.views.place'),
#url(r'^places/(?P<url>.*)', 'place_exposition.views.place'),
#url(r'^company/(?P<url>.*)', 'core.views.company'),
url(r'^', include('password_reset.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
#url(r'^social/', include('social_auth.urls')),
# admin part
#url(r'^', include('settings.old_urls')),
url(r'^search/', include('haystack.urls')),
url(r'^', include('service.urls')),
)
# test urls
from accounts.models import User
def delete_user(request):
request.user.delete()
#User.objects.filter(email='kotzillla@gmail.com').delete()
return HttpResponse('deleted')
def delete_user_info(request):
user = request.user
user.url = ''
user.company = None
user.position = ''
user.save()
pr = user.profile
pr.city = None
pr.country = None
pr.about_company = ''
pr.phone = None
pr.web_page = ''
pr.about = ''
pr.facebook = ''
pr.vk = ''
pr.twitter = ''
pr.linkedin = ''
pr.save()
return HttpResponse('info deleted')
urlpatterns += patterns('',
url(r'^delete-user/', delete_user),
url(r'^delete-user-info/', delete_user_info),
)
# ajax urls
urlpatterns += patterns('',
@ -113,14 +65,14 @@ urlpatterns += patterns('',
url(r'^search-form/autosearch/exposition/$', 'settings.views.expo_autosearch'),
url(r'^search-form/autosearch/place/$', 'settings.views.place_autosearch'),
url(r'^search-form/autosearch/company/$', 'settings.views.company_autosearch'),
url(r'^', include('settings.old_urls')),
url(r'^', include('accounts.user_catalog_urls')),
)
"""
if settings.DEBUG:
import debug_toolbar
urlpatterns += patterns('',
url(r'^__debug__/', include(debug_toolbar.urls)),
)
"""
)

@ -28,16 +28,15 @@ class ServiceForm(forms.Form):
url = forms.CharField(label='url', required=False)
price = forms.IntegerField(label='Цена', required=False,
widget=forms.TextInput(attrs={'placeholder':'Валюта'}))
#price = forms.CharField(label='Цена', required=False,
# widget=forms.TextInput(attrs={'placeholder':'Валюта'}))
currency_list = [('USD','USD'), ('EUR','EUR'), ('RUB','RUB')]
currency = forms.ChoiceField(choices=currency_list)
type = forms.MultipleChoiceField(label='Тип', choices=[('expo', 'expo'), ('conference', 'conference')])
service_id = forms.CharField(required=False, widget=forms.HiddenInput())
def __init__(self, *args, **kwargs):
super(ServiceForm, self).__init__(*args, **kwargs)
# creates translated form fields, example: name_ru, name_en
@ -76,6 +75,8 @@ class ServiceForm(forms.Form):
service.price = data['price']
service.currency = data['currency']
#data['type']
fill_with_signal(Service, service, data)

@ -2,6 +2,7 @@
from django.db import models
from hvad.models import TranslatableModel, TranslatedFields, TranslationManager
from functions.custom_fields import EnumField
from bitfield import BitField
CURENCIES = ('', 'USD', 'RUB', 'EUR')
@ -12,12 +13,12 @@ CURENCIES = ('', 'USD', 'RUB', 'EUR')
class Service(TranslatableModel):
url = models.SlugField(unique=True)
currency = EnumField(values=CURENCIES, blank=True, default='USD')
price = models.PositiveIntegerField(blank=True, null=True)
params = models.CharField(max_length=255, blank=True)
template = models.CharField(max_length=255, blank=True)
type = BitField(flags=['expo', 'conference'])
#translated fields
translations = TranslatedFields(
name = models.CharField(max_length=50),
@ -78,6 +79,8 @@ class AbstractOrder(models.Model):
class Catalog(AbstractOrder):
pass
class BuildStand(AbstractOrder):
pass
class Tickets(AbstractOrder):
days = models.SmallIntegerField()

@ -2,7 +2,7 @@
from django import forms
from django.utils.translation import ugettext as _
from accounts.models import User
from models import Catalog, Tickets, Remote, Participation, Translation, Visit, CURENCIES, Advertising, CallBack
from models import Catalog, Tickets, Remote, Participation, Translation, Visit, CURENCIES, Advertising, CallBack, BuildStand
from exposition.models import Exposition
from conference.models import Conference
from seminar.models import Seminar
@ -89,6 +89,10 @@ class CatalogForm(AbstractOrderForm):
class Meta:
model = Catalog
class BuildStandForm(AbstractOrderForm):
class Meta:
model = BuildStand
class TicketsForm(AbstractOrderForm):
class Meta:

@ -7,13 +7,14 @@ from haystack.query import EmptySearchQuerySet
from django.shortcuts import get_object_or_404
from django.http import Http404
import json
from functions.search_forms import CompanySearchForm
#from functions.search_forms import CompanySearchForm
from order_forms import TranslationForm, CatalogForm, VisitForm, RemoteForm, ParticipationForm, TicketsForm, AdvertiseForm
from order_forms import TranslationForm, CatalogForm, VisitForm, RemoteForm, ParticipationForm, TicketsForm,\
AdvertiseForm, BuildStandForm
order_forms = {'translator': TranslationForm, 'catalog': CatalogForm, 'participation': ParticipationForm,
'remote': RemoteForm, 'tickets': TicketsForm, 'visit': VisitForm}
'remote': RemoteForm, 'tickets': TicketsForm, 'visit': VisitForm, 'buildstand': BuildStandForm}
class ServiceView(FormView):

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.http import HttpResponse
from django.views.decorators.cache import cache_page
from redirect_views import old_redirect, old_profile
urlpatterns = patterns('',
url(r'/rubricator.php?result_type=conference$', old_redirect, {'redirect_url': '/conference/'}), #???
# city
url(r'^conference/city-(?P<city>.*)/year-(?P<year>\d+)/month-(?P<month>.*)$', old_redirect, {'redirect_url': '/conference/city/{city}/{year}/{month}/'}),
url(r'^conference/city-(?P<city>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/conference/city/{city}/{year}/'}),
url(r'^conference/city-(?P<city>.*)/$', old_redirect, {'redirect_url': '/conference/city/{city}/'}),
#url(r'^conference/(?P<city>.*)/$', old_redirect, {'redirect_url': '/conference/city/{city}/'}), # перенести
# country
url(r'^conference/country-(?P<country>.*)/year-(?P<year>\d+)/month-(?P<month>.*)$', old_redirect, {'redirect_url': '/conference/country/{country}/{year}/{month}/'}),
url(r'^conference/country-(?P<country>.*)/year-(?P<year>\d+)/$', old_redirect, {'redirect_url': '/conference/country/{country}/{year}/'}),
url(r'^conference/country-(?P<country>.*)/$', old_redirect, {'redirect_url': '/conference/country/{country}/'}),
#url(r'/conference/(?P<country>.*)/$', old_redirect, {'redirect_url': '/conference/country/{country}/'}), # перенести
# 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+)/$', 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+)/$', 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>.*)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/'}), # перенести
url(r'^conference/theme-(?P<theme>.*)/$', old_redirect, {'redirect_url': '/conference/theme/{theme}/'}),
)

@ -0,0 +1 @@
__author__ = 'root'

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.test.client import RequestFactory
from django.utils import translation
from django.conf import settings
from exposition.views import ExpositionByCity
class Command(BaseCommand):
def handle(self, *args, **options):
langs = [code for code, name in settings.LANGUAGES]
print(langs)
#request = RequestFactory().get('/expo/city/')
#view = ExpositionByCity.as_view()
#response = view(request, name='bob')
print('success')

@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.http import HttpResponse
from django.views.decorators.cache import cache_page
from redirect_views import old_redirect, old_profile
def test(request):
return HttpResponse('test')
urlpatterns = patterns('',
# service
url(r'^rubricator.php/?result_type=expo$', old_redirect, {'redirect_url': '/expo/'}), #???
url(r'^serv-zaoch-info.php$', old_redirect, {'redirect_url': '/service/remote/'}),
url(r'^serv-visit-info.php$', old_redirect, {'redirect_url': '/service/visit/'}),
url(r'^serv-bilet-info.php$', old_redirect, {'redirect_url': '/service/tickets/'}),
url(r'^serv-translator-info.php$', old_redirect, {'redirect_url': '/service/translator/'}),
url(r'^(?P<some>.*)/(?P<event>.*)/buildstand.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/buildstand/'}),
url(r'^(?P<some>.*)/(?P<event>.*)/bilet.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/tickets/'}),
url(r'^(?P<some>.*)/(?P<event>.*)/zaoch.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/remote/'}),
url(r'^(?P<some>.*)/(?P<event>.*)/translator.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/translator/'}),
url(r'^(?P<some>.*)/(?P<event>.*)/visit.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/visit/'}),
url(r'^(?P<some>.*)/(?P<event>.*)/uchastie.html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/service/participation/'}),
# company
url(r'^company/(?P<company>.*)$', old_redirect, {'redirect_url': '/members/{company}/'}),
# articles and news
url(r'^articles.php$', old_redirect, {'redirect_url': '/blogs/'}),
url(r'^news.php$', old_redirect, {'redirect_url': '/news/'}),
url(r'^news.php/news/archive/', old_redirect, {'redirect_url': '/news/'}),
url(r'^article_info.php/articles_id/(?P<article>\d+)/(?P<some>.*)$', old_redirect, {'redirect_url': '/blogs/{article}/'}),
url(r'^news.php/news_id/(?P<article>\d+)/(?P<some>.*)$', old_redirect, {'redirect_url': '/news/{article}/'}),
# users
url(r'^users/(?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/'}),
url(r'^account_password.php$', old_redirect, {'redirect_url': '/profile/settings/'}),
#url(r'^serv-personal-info.php$', old_redirect, {'redirect_url': '/service/staff/'}),
# EXPO
# 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+)/$', 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>.*)/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>.*)/$', old_redirect, {'redirect_url': '/expo/city/{city}/'}),
# 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+)/$', 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>.*)/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>.*)/$', old_redirect, {'redirect_url': '/expo/country/{country}/'}),
url(r'^catalog/country-(?P<country>.*)/$', old_redirect, {'redirect_url': '/expo/country/{country}/'}),
url(r'^catalog/country/$', old_redirect, {'redirect_url': '/expo/country/'}),
# 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+)/$', 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+)/$', 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>.*)/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+)/$', 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>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/'}),
url(r'^catalog/theme-(?P<theme>.*)/$', old_redirect, {'redirect_url': '/expo/theme/{theme}/'}),
url(r'^catalog/theme/$', old_redirect, {'redirect_url': '/expo/theme/'}),
# tag
url(r'^tag/(?P<tag>.*)/$', old_redirect, {'redirect_url': '/expo/tag/{tag}/'}),
url(r'^catalog/(?P<city>.*)/$', old_redirect, {'redirect_url': '/expo/city/{city}/'}),
url(r'^catalog/$', old_redirect, {'redirect_url': '/expo/city/'}),
# tag
url(r'^(?P<some>.*)/(?P<event>.*).html$', old_redirect, {'redirect_url': '{event_catalog}{event_url}/'}),
)

@ -0,0 +1,97 @@
from django.http import HttpResponseRedirect, HttpResponse, Http404, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from city.models import City
from country.models import Country
from theme.models import Theme, Tag
from exposition.models import Exposition
from conference.models import Conference
from company.models import Company
from article.models import Article
from accounts.models import User
class RedirectMixin(object):
model = None
def get_object_url(self, key, value):
Model = self.model
try:
obj = Model.objects.get(old_url=value)
except:
obj = get_object_or_404(Model, url=value)
if obj:
return {key: obj.url}
else:
raise Http404
class CityRedirect(RedirectMixin):
model = City
class CountryRedirect(RedirectMixin):
model = Country
class ThemeRedirect(RedirectMixin):
model = Theme
class TagRedirect(RedirectMixin):
model = Tag
class CompanyRedirect(RedirectMixin):
model = Company
class EventRedirect(object):
def get_object_url(self,key, value):
try:
obj = Exposition.objects.get(old_url=value)
except Exposition.DoesNotExist:
obj = Exposition.objects.safe_get(url=value)
if not obj:
try:
obj = Conference.objects.get(old_url=value)
except Conference.DoesNotExist:
obj = Conference.objects.safe_get(url=value)
if obj:
return {'event_url': obj.url, 'event_catalog': obj.catalog}
else:
raise Http404
class ArticleRedirect(object):
def get_object_url(self,key, value):
obj = get_object_or_404(Article, id=value)
return {key: obj.slug}
class UserRedirect(object):
def get_object_url(self,key, value):
obj = get_object_or_404(User, url=value)
return {key: obj.url}
old_params = {'city': CityRedirect, 'country': CountryRedirect, 'theme': ThemeRedirect, 'tag': TagRedirect,
'event': EventRedirect, 'company': Company, 'article': ArticleRedirect, 'user': UserRedirect}
def old_redirect(request, *args, **kwargs):
redirect = kwargs.get('redirect_url')
params = dict(kwargs)
updates = {}
for key, value in params.iteritems():
if key in old_params:
redirect_obj = old_params[key]()
updates.update(redirect_obj.get_object_url(key, value))
params.update(updates)
redirect = redirect.format(**params)
return HttpResponsePermanentRedirect(redirect)
def old_profile(request):
user = request.user
if user.is_authenticated():
return HttpResponseRedirect('/%s/'%user.url)
else:
raise Http404

@ -121,6 +121,45 @@
</div>
</div>
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-pencil"></i> Управления услугами</h2>
</div>
<div class="box-content">
<div class="control-group">
<label class="control-label">Выставки</label>
<div class="controls">
<button class="btn btn-success">Включить все выставки</button>
</div>
</div>
<div class="control-group">
<label class="control-label">&nbsp;</label>
<div class="controls">
<input type="text">
</div>
</div>
<div class="control-group">
<label class="control-label">Конференции</label>
<div class="controls">
<button class="btn">Включить все конференции</button>
</div>
</div>
<div class="control-group">
<label class="control-label">&nbsp;</label>
<div class="controls">
<input type="text">
</div>
</div>
</div>
</div>
<div class="controls">
<input class="btn btn-large btn-primary" type="submit" value="Добавить">
<input class="btn btn-large" type="reset" value="Отмена">

@ -23,20 +23,22 @@
{% endblock %}
{% block content_list %}
{% for obj in object_list %}
{% set cur_word = obj.name %}
{% if cur_word|slice:":1"|lower != prev_word|slice:":1"|lower and forloop.counter != 1 %}
</ul>
{% endif %}
{% if cur_word|slice:":1"|lower != prev_word|slice:":1"|lower %}
<ul class="leter-list">
<div class="leter"><font size="5">{{ cur_word|slice:":1"|upper }}</font></div>
{% endif %}
<li>
<a href="{{ expo_catalog }}{{ catalog }}{{ obj.url }}/">{{ obj.name }}&nbsp;({{ obj.expositions_number }})</a>
</li>
{% set prev_word = obj.name %}
{% endfor %}
{% with objects=object_list %}
{% for obj in objects %}
{% set cur_word = obj.name %}
{% if cur_word|slice:":1"|lower != prev_word|slice:":1"|lower and forloop.counter != 1 %}
</ul>
{% endif %}
{% if cur_word|slice:":1"|lower != prev_word|slice:":1"|lower %}
<ul class="leter-list">
<div class="leter"><font size="5">{{ cur_word|slice:":1"|upper }}</font></div>
{% endif %}
<li>
<a href="{{ expo_catalog }}{{ catalog }}{{ obj.url }}/">{{ obj.name }}&nbsp;({{ obj.expositions_number }})</a>
</li>
{% set prev_word = obj.name %}
{% endfor %}
{% endwith %}
{% endblock %}

@ -118,7 +118,7 @@
</div>
</div>
</div>
{% include 'client/includes/exposition/exposition_services.html' %}
{% include 'client/includes/conference/conference_services.html' with event=event %}
{% include 'includes/event_steps.html' with event=event %}
@ -127,7 +127,7 @@
<hr />
<div class="i-photo-slides">
<div class="sect-title"><a href="#">{% trans 'Фотографии с прошлой выставки' %}</a></div>
<div class="sect-title"><a href="#">{% trans 'Фотографии с прошлой конференции' %}</a></div>
<div id="ps-photo-gallery" class="ps-photo-gallery swiper-container">
<ul class="swiper-wrapper">
{% for photo in photos %}
@ -147,7 +147,7 @@
{% if event.description %}
<div class="i-event-description">
<div class="ied-title">{% trans 'О выставке' %} {{ event.name|safe }}</div>
<div class="ied-title">{% if event.event_type == 'expo' %}{% trans 'О выставке' %}{% else %}{% trans 'О конференции' %}{% endif %} {{ event.name|safe }}</div>
<div class="ied-text">{{ event.description|safe|linebreaks }}</div>
</div>
<hr />
@ -207,9 +207,9 @@
{% if companies %}
{# есть участники #}
<header>
<div class="im-title">{% trans 'Участники' %}</div>
<div class="im-title">{% trans 'Спикеры' %}</div>
<a class="more" href="{{ event.get_permanent_url }}members/">{% trans 'Все участники' %}</a>
<a class="more" href="{{ event.get_permanent_url }}members/">{% trans 'Все спикеры' %}</a>
</header>
<ul>
{% for company in companies %}
@ -230,10 +230,10 @@
{% else %}
{# нет участников #}
<header>
<div class="im-title">{% trans 'Участники' %}</div>
<div class="im-title">{% trans 'Спикеры' %}</div>
<p>{% trans 'Привлекайте целевых посетителей на стенд' %}</p>
<!--//todo: обработчик-->
<p><a href="#pw-advertise" class="button icon-up pw-open" >Рекламировать участника</a></p>
<p><a href="#pw-advertise" class="button icon-up pw-open" >{% trans 'Рекламировать спикера' %}</a></p>
</header>
{% endif %}
{% endwith %}

@ -0,0 +1,12 @@
{% load i18n %}
<div class="i-sub-articles">
<ul>
<li>
<a href="{{ event.get_permanent_url }}service/translator/">{% trans 'Устный переводчик' %}</a>
</li>
<li>
<a href="{{ event.get_permanent_url }}service/visit/">{% trans 'Бизнес-тур "под ключ"' %}</a>
</li>
</ul>
</div>

@ -1,14 +1,14 @@
{% load i18n %}
<div class="i-steps">
<div class="is-title">{% trans 'Посетить выставку' %}</div>
<div class="is-title">{% if event.catalog == '/expo/' %}{% trans 'Посетить выставку' %}{% else %}{% trans 'Посетить конференцию' %}{% endif %}</div>
<ul>
<li class="s1">
<div class="label">1. {% trans 'Зарегистрируйтесь на событие' %}</div>
<a class="step"
href="{% if event.registration_link %}{{ registration_link }}{% else %}{{ event.get_permanent_url }}service/tickets/{% endif %}"
target="_blank">
{% trans 'Билеты на выставку' %}
{% if event.catalog == '/expo/' %}{% trans 'Билеты на выставку' %}{% else %}{% trans 'Регистрация' %}{% endif %}
</a>
</li>

@ -1,5 +1,8 @@
{% load i18n %}
{% load template_filters %}
{% ifequal LANGUAGE_CODE 'ru' %}
{% load pymorphy_tags %}
{% endifequal %}
<div class="m-article">
<div class="item-wrap event clearfix">
@ -75,55 +78,68 @@
{% with statistics=exposition.statistic.all %}
{% for st in statistics %}
<div class="ep-sect">
<div class="ep-sect-title"><a class="eps-open" href="#">{{ st.year }}</a></div>
<div class="ep-sect-body">
<div class="ep-stats clearfix">
<div class="eps-item ">
<b>{{ st.visitors }}</b>
<div class="eps-text">{% trans 'посетителей' %}</div>
</div>
<div class="eps-item">
<b>{{ st.members }}</b>
<div class="eps-text">{% trans 'участников' %}</div>
</div>
</div>
<div class="ep-info clearfix">
{% if st.area %}
<div class="ep-area-wrap">
<div class="epa-title">{% trans 'Общая выставочная площадь' %}</div>
<div class="epa-area">{{ st.area }} {% trans 'м' %}<sup>2</sup></div>
</div>
{% endif %}
<div class="ep-founded"><b>{{ exposition.foundation_year }}</b> год основания</div>
</div>
{% if st.countries_number or st.countries %}
<div class="ep-countries clearfix">
<div class="epc-title">{% trans 'Страны' %}</div>
<div class="epc-list">
{% if st.countries_number %}
<ul>
<li>{{ st.countries_number }} {% trans 'стран-участниц' %}</li>
</ul>
{% else %}
{% with html=st.countries|generate_countries_list %}
{{ html|safe }}
{% endwith %}
{% endif %}
</div>
</div>
{% endif %}
</div>
<div class="ep-sect-title"><a class="eps-open" href="#">{{ st.year }}</a></div>
<div class="ep-sect-body">
<div class="ep-stats clearfix">
<div class="eps-item ">
<b>{{ st.visitors }}</b>
<div class="eps-text">
{% ifequal LANGUAGE_CODE 'ru' %}
{{ "посетитель"|plural:st.visitors }}
{% else %}
{% trans 'посетителей' %}
{% endifequal %}
</div>
</div>
<div class="eps-item">
<b>{{ st.members }}</b>
<div class="eps-text">
{% ifequal LANGUAGE_CODE 'ru' %}
{{ "участник"|plural:st.members }}
{% else %}
{% trans 'участников' %}
{% endifequal %}
</div>
</div>
</div>
<div class="ep-info clearfix">
{% if st.area %}
<div class="ep-area-wrap">
<div class="epa-title">{% trans 'Общая выставочная площадь' %}</div>
<div class="epa-area">{{ st.area }} {% trans 'м' %}<sup>2</sup></div>
</div>
{% endif %}
<div class="ep-founded"><b>{{ exposition.foundation_year }}</b> год основания</div>
</div>
{% if st.countries_number or st.countries %}
<div class="ep-countries clearfix">
<div class="epc-title">{% trans 'Страны' %}</div>
<div class="epc-list">
{% if st.countries_number %}
<ul>
<li>{{ st.countries_number }} {% trans 'стран-участниц' %}</li>
</ul>
{% else %}
{% with html=st.countries|generate_countries_list %}
{{ html|safe }}
{% endwith %}
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
{% endfor %}

@ -19,11 +19,11 @@
{{ place.name|safe }}
</div>
<div class="i-descr annotation-part">
{{ place.description.strip|safe|linebreaks }}
{{ place.description.strip|safe|linebreaks|truncatewords:20 }}
</div>
<a class="i-descr-readmore" href="javascript:void(0);">{% trans 'Далее...' %}</a>
<div class="i-descr full-part hidden" >
<p><br><strong>«Экспоцентр»</strong> заключил Соглашение с ГБУ «Малый бизнес Москвы» о возмещении предприятиям, принимающим участие в выставках «Экспоцентра», части их затрат из бюджетных средств.<br><br>Соглашение заключено в рамках реализации программы Правительства Москвы по поддержке деятельности субъектов малого и среднего предпринимательства, направленной на продвижение их продукции. Особое внимание уделяется участию в выставочных мероприятиях.<br><br><strong>«Экспоцентр»</strong> широко использует новейшие выставочные и маркетинговые технологии, предоставляет экспонентам и посетителям большой набор профессиональных решений для эффективной подготовки и проведения выставочных проектов любого формата, максимально комфортные условия для деловых контактов в формате «В2В».<br><br>Полезным для экспонентов является участие в семинарах «Эффективное участие в выставке», которые могут посетить все желающие.<br><br>В «Экспоцентре» организована система «одного окна», которая позволяет экспонентам быстро заказать необходимые услуги в одном месте.<br><br>Участники и посетители-специалисты активно используют систему «Назначение деловых встреч» (MatchMaking), позволяющую потенциальным партнерам найти друг друга, заблаговременно договориться о встрече на выставке.<br><br>Для посетителей выставки на сайте «Экспоцентра» предусмотрена процедура предварительной регистрации, позволяющая специалистам заблаговременно получить по электронной почте пригласительный билет на ежедневное посещение выставки. <br><br>Центральный выставочный комплекс <strong>«Экспоцентр»</strong> (ЦВК <strong>«Экспоцентр»</strong>) включает в себя 9 выставочных павильонов и 32 многофункциональных зала для конгрессов, семинаров и деловых презентаций. Общая выставочная площадь - 165 тыс. кв. м (закрытая - 105 тыс. кв. м, открытая - 60 тыс. кв. м). Возможности павильонов позволяют проводить выставки тяжелого машиностроения с демонстрацией экспонатов в действии. Для проведен</p>
{{ place.description.strip|safe|linebreaks }}
</div>
{% if place.address %}
<div class="i-address map-opened">
@ -162,19 +162,30 @@
</ul>
</div>
</div>
{% if place.total_year_action %}
<div class="eni-areas stat clearfix">
<div class="eni-title">
{% trans 'Ежегодно проводится' %}
</div>
<div class="enis-col">
<b>{{ place.total_year_action }}</b>
{% trans 'событий' %}
</div>
{% if place.total_year_action.isdigit %}
{% ifequal LANGUAGE_CODE 'ru' %}
{% load pymorphy_tags %}
<b>{{ place.total_year_action }}</b>
{{ "событие"|plural:place.total_year_action }}
{% else %}
<b>{{ place.total_year_action }}</b>
{% trans 'событий' %}
{% endifequal %}
{% else %}
<b>{{ place.total_year_action }}</b>
{% endif %}
</div>
</div>
{% endif %}
{% if place.foundation_year %}
<div class="eni-areas">

@ -0,0 +1,199 @@
{% extends 'base_catalog.html' %}
{% load static %}
{% load i18n %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
{% if object %}
<a href="/">{% trans 'Главная страница' %}</a>
<a href="{{ object.catalog }}">{{ object.catalog_name }}</a>
<a href="{{ object.catalog }}country/{{ object.country.url }}/">{{ object.country }}</a>
<a href="{{ object.catalog }}city/{{ object.city.url }}/">{{ object.city }}</a>
<a href="{{ object.get_permanent_url }}">{{ object.name }}</a>
<strong>{% trans 'Строительство стенда' %}</strong>
{% else %}
<a href="/">{% trans 'Главная страница' %}</a>
<strong>{% trans 'Строительство стенда' %}</strong>
{% endif %}
</div>
{% endblock %}
{% block page_title %}
<div class="page-title">
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Строительство стенда' %} {% if object %}{% trans 'на' %} {{ object.name }} {% endif %}{% endif %}</h1>
</div>
{% endblock %}
{% block page_body %}
<div class="page-body clearfix request-form rq-catalog">
<div class="m-article">
<div class="rq-info clearfix">
<div class="rqi-pict"><img src="{% static 'client/img/_del-temp/request-catalog.png' %}" alt="" /></div>
<div class="rqi-body">
<h2>{% trans 'Предлагаем Вам заказать печатный каталог выставки' %}{% if object %} {{ object.name }} {% endif %}</h2>
<div class="rqi-cols">
<ul>
<li>{% trans 'вся информация о выставке' %}</li>
<li>{% trans 'экономия времени' %}</li>
<li>{% trans 'все потенциальные контакты' %}</li>
</ul>
<ul>
<li>{% trans 'вся информация о выставке' %}</li>
<li>{% trans 'экономия времени' %}</li>
<li>{% trans 'все потенциальные контакты' %}</li>
</ul>
</div>
</div>
</div>
<div class="rq-form" {% if form.errors %}style="display:block"{% endif %}>
<form action="#" method="post">{% csrf_token %}
<hr />
<div class="rq-form-sect rq-contacts-data">
<div class="rqf-title">{% trans 'Ваши контактные данные' %}</div>
<div class="mf-line rq-person">
<div class="mf-field">
{{ form.person_inf }}
</div>
</div>
<div class="mf-line rq-person">
<div class="mf-field error">
{{ form.person_inf.errors }}
</div>
</div>
<div class="mf-line cols-2 rq-place">
<div class="mf-field rq-country">
{{ form.country }}
</div>
<div class="mf-field rq-city">
{{ form.city }}
</div>
</div>
<div class="mf-line cols-2 rq-place">
<div class="mf-field rq-country error">
{{ form.country.errors }}
</div>
<div class="mf-field rq-city error">
{{ form.city.errors }}
</div>
</div>
<div class="mf-line cols-2 rq-contacts">
<div class="mf-field rq-tel">
{{ form.phone }}
</div>
<div class="mf-field rq-mail">
{{ form.person }}
</div>
</div>
<div class="mf-line cols-2 rq-contacts">
<div class="mf-field rq-tel error">
{{ form.phone.errors }}
</div>
<div class="mf-field rq-mail error">
{{ form.person.errors }}
</div>
</div>
</div>
<hr />
<div class="rq-btn-wrap">
<div class="rq-order-button">
<div class="rqob-wrap">
<div class="rqob-price">{{ service.price }} {{ service.currency }} + {% trans 'стоимость каталога' %}</div>
<div class="rqob-button">
{% if service.price %}
<input id="id_price" name="price" type="hidden" value="{{ service.price }}"/>
{% endif %}
{% if service.price %}
<input id="id_currency" name="currency" type="hidden" value="{{ service.currency }}"/>
{% endif %}
<button type="submit">{% trans 'Сделать запрос' %}</button>
</div>
</div>
</div>
<div class="ob-descr">{% trans 'Стоимость каталога оплачивается c учетом доставки, которую обозначают организаторы выставки (в среднем от 0 до 50 евро).' %}</div>
</div>
</form>
</div>
<div class="rq-btn-wrap rq-btn-to-hide">
<div class="rq-order-button">
<div class="rqob-wrap">
<div class="rqob-price">{{ service.price }} {{ service.currency }} + {% trans 'стоимость каталога' %}</div>
<div class="rqob-button">
<a class="ob-text" href="#">{% trans 'Сделать запрос' %}</a>
</div>
</div>
</div>
<div class="ob-descr">{% trans 'Стоимость каталога оплачивается c учетом доставки, которую обозначают организаторы выставки (в среднем от 0 до 50 евро).' %}</div>
</div>
{% if messages %}
<div class="alert-message">
<ul>
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>
{{ message }}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<hr />
<div class="rq-note">
{% trans '<p><b>Внимание!</b> Мы не можем гарантировать то, что все организаторы предоставляют возможность заказа печатного каталога выставки. Получая Ваш запрос, мы персонально связываемся с организатором конкретного события и уточняем информацию об условиях приобретения. Только после этого мы подтверждаем Вам возможность заказа.</p>' %}
</div>
</div>
<div class="rq-to-hide">
<div class="i-sub-articles">
<ul>
{% if object %}
<li><a href="{{ object.get_permanent_url }}service/visit/">{% trans 'Бизнес-тур «под ключ' %}»</a></li>
<li><a href="{{ object.get_permanent_url }}service/translator/">{% trans 'Устный переводчик' %}</a></li>
<li><a href="{{ object.get_permanent_url }}service/participation/">{% trans 'Участие в выставке' %}</a></li>
<li><a href="{{ object.get_permanent_url }}service/remote/">{% trans 'Заочное посещение' %}</a></li>
{% else %}
<li><a href="/service/visit/">{% trans 'Бизнес-тур «под ключ' %}»</a></li>
<li><a href="/service/translator/">{% trans 'Устный переводчик' %}</a></li>
<li><a href="/service/participation/">{% trans 'Участие в выставке' %}</a></li>
<li><a href="/service/remote/">{% trans 'Заочное посещение' %}</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endblock %}

@ -0,0 +1,70 @@
{% load i18n %}{% load static from staticfiles %}{% load url from future %}
<style type="text/css">
@media print { #djDebug {display:none;}}
</style>
<link rel="stylesheet" href="{% static 'debug_toolbar/css/toolbar.css' %}" type="text/css" />
{% if toolbar.config.JQUERY_URL %}
<!-- Prevent our copy of jQuery from registering as an AMD module on sites that use RequireJS. -->
<script>var _djdt_define_backup = window.define; window.define = undefined;</script>
<script src="{{ toolbar.config.JQUERY_URL }}"></script>
<script>var djdt = {jQuery: jQuery.noConflict(true)}; window.define = _djdt_define_backup;</script>
{% else %}
<script>var djdt = {jQuery: jQuery};</script>
{% endif %}
<script src="{% static 'debug_toolbar/js/toolbar.js' %}"></script>
<div id="djDebug" style="display:none;" dir="ltr"
data-store-id="{{ toolbar.store_id }}" data-render-panel-url="{% url 'djdt:render_panel' %}"
{{ toolbar.config.ROOT_TAG_EXTRA_ATTRS|safe }}>
<div style="display:none;" id="djDebugToolbar">
<ul id="djDebugPanelList">
{% if toolbar.panels %}
<li><a id="djHideToolBarButton" href="#" title="{% trans "Hide toolbar" %}">{% trans "Hide" %} &#187;</a></li>
{% else %}
<li id="djDebugButton">DEBUG</li>
{% endif %}
{% for panel in toolbar.panels %}
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdt{{ panel.panel_id }}" {% if panel.enabled %}checked="checked" title="{% trans "Disable for next and successive requests" %}"{% else %}title="{% trans "Enable for next and successive requests" %}"{% endif %} />
{% if panel.has_content and panel.enabled %}
<a href="#" title="{{ panel.title }}" class="{{ panel.panel_id }}">
{% else %}
<div class="djdt-contentless{% if not panel.enabled %} djdt-disabled{% endif %}">
{% endif %}
{{ panel.nav_title }}
{% if panel.enabled %}
{% with panel.nav_subtitle as subtitle %}
{% if subtitle %}<br /><small>{{ subtitle }}</small>{% endif %}
{% endwith %}
{% endif %}
{% if panel.has_content and panel.enabled %}
</a>
{% else %}
</div>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
<div style="display:none;" id="djDebugToolbarHandle">
<span title="{% trans "Show toolbar" %}" id="djShowToolBarButton">&#171;</span>
</div>
{% for panel in toolbar.panels %}
{% if panel.has_content and panel.enabled %}
<div id="{{ panel.panel_id }}" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>{{ panel.title|safe }}</h3>
</div>
<div class="djDebugPanelContent">
{% if toolbar.store_id %}
<img src="{% static 'debug_toolbar/img/ajax-loader.gif' %}" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
{% else %}
<div class="djdt-scroll">{{ panel.content }}</div>
{% endif %}
</div>
</div>
{% endif %}
{% endfor %}
<div id="djDebugWindow" class="djdt-panelContent"></div>
</div>

@ -0,0 +1,69 @@
{% load i18n %}
<h4>{% trans "Summary" %}</h4>
<table>
<thead>
<tr>
<th>{% trans "Total calls" %}</th>
<th>{% trans "Total time" %}</th>
<th>{% trans "Cache hits" %}</th>
<th>{% trans "Cache misses" %}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ total_calls }}</td>
<td>{{ total_time }} ms</td>
<td>{{ hits }}</td>
<td>{{ misses }}</td>
</tr>
</tbody>
</table>
<h4>{% trans "Commands" %}</h4>
<table>
<thead>
<tr>
{% for name in counts.keys %}
<th>{{ name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
<tr>
{% for value in counts.values %}
<td>{{ value }}</td>
{% endfor %}
</tr>
</tbody>
</table>
{% if calls %}
<h4>{% trans "Calls" %}</h4>
<table>
<thead>
<tr>
<th colspan="2">{% trans "Time (ms)" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Arguments" %}</th>
<th>{% trans "Keyword arguments" %}</th>
<th>{% trans "Backend" %}</th>
</tr>
</thead>
<tbody>
{% for call in calls %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}" id="cacheMain_{{ forloop.counter }}">
<td class="djdt-toggle">
<a class="djToggleSwitch" data-toggle-name="cacheMain" data-toggle-id="{{ forloop.counter }}" data-toggle-open="+" data-toggle-close="-" href="javascript:void(0)">+</a>
</td>
<td>{{ call.time|floatformat:"4" }}</td>
<td>{{ call.name|escape }}</td>
<td>{{ call.args|escape }}</td>
<td>{{ call.kwargs|escape }}</td>
<td>{{ call.backend }}</td>
</tr>
<tr class="djUnselected djDebugHoverable {% cycle 'djDebugOdd' 'djDebugEven' %} djToggleDetails_{{ forloop.counter }}" id="cacheDetails_{{ forloop.counter }}">
<td colspan="1"></td>
<td colspan="5"><pre class="djdt-stack">{{ call.trace }}</pre></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}

@ -0,0 +1,60 @@
{% load i18n %}
<h4>{% trans "Request headers" %}</h4>
<table>
<thead>
<tr>
<th>{% trans "Key" %}</th>
<th>{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for key, value in request_headers.items %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ key|escape }}</td>
<td>{{ value|escape }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<h4>{% trans "Response headers" %}</h4>
<table>
<thead>
<tr>
<th>{% trans "Key" %}</th>
<th>{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for key, value in response_headers.items %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ key|escape }}</td>
<td>{{ value|escape }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<h4>{% trans "WSGI environ" %}</h4>
<p>{% trans "Since the WSGI environ inherits the environment of the server, only a significant subset is shown below." %}</p>
<table>
<thead>
<tr>
<th>{% trans "Key" %}</th>
<th>{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for key, value in environ.items %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ key|escape }}</td>
<td>{{ value|escape }}</td>
</tr>
{% endfor %}
</tbody>
</table>

@ -0,0 +1,28 @@
{% load i18n %}
{% if records %}
<table>
<thead>
<tr>
<th>{% trans "Level" %}</th>
<th>{% trans "Time" %}</th>
<th>{% trans "Channel" %}</th>
<th>{% trans "Message" %}</th>
<th>{% trans "Location" %}</th>
</tr>
</thead>
<tbody>
{% for record in records %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ record.level }}</td>
<td>{{ record.time|date:"h:i:s m/d/Y" }}</td>
<td>{{ record.channel|default:"-" }}</td>
<td>{{ record.message|linebreaksbr }}</td>
<td>{{ record.file }}:{{ record.line }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "No messages logged" %}.</p>
{% endif %}

@ -0,0 +1,37 @@
{% load i18n %}{% load static from staticfiles %}
<table width="100%">
<thead>
<tr>
<th>{% trans "Call" %}</th>
<th>{% trans "CumTime" %}</th>
<th>{% trans "Per" %}</th>
<th>{% trans "TotTime" %}</th>
<th>{% trans "Per" %}</th>
<th>{% trans "Count" %}</th>
</tr>
</thead>
<tbody>
{% for call in func_list %}
<!-- style="background:{{ call.background }}" -->
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %} djDebugProfileRow{% for parent_id in call.parent_ids %} djToggleDetails_{{ parent_id }}{% endfor %}" depth="{{ call.depth }}">
<td>
<div style="padding-left: {{ call.indent }}px;">
{% if call.has_subfuncs %}
<a class="djProfileToggleDetails djToggleSwitch" data-toggle-id="{{ call.id }}" data-toggle-open="+" data-toggle-close="-" href="javascript:void(0)">-</a>
{% else %}
<span class="djNoToggleSwitch"></span>
{% endif %}
<span class="djdt-stack">{{ call.func_std_string }}</span>
</div>
</td>
<td>{{ call.cumtime|floatformat:3 }}</td>
<td>{{ call.cumtime_per_call|floatformat:3 }}</td>
<td>{{ call.tottime|floatformat:3 }}</td>
<td>{{ call.tottime_per_call|floatformat:3 }}</td>
<td>{{ call.count }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<script src="{% static 'debug_toolbar/js/toolbar.profiling.js' %}"></script>

@ -0,0 +1,124 @@
{% load i18n %}
<h4>{% trans "View information" %}</h4>
<table>
<thead>
<tr>
<th>{% trans "View function" %}</th>
<th>{% trans "Arguments" %}</th>
<th>{% trans "Keyword arguments" %}</th>
<th>{% trans "URL name" %}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="djDebugOdd"><code>{{ view_func }}</code></td>
<td class="djDebugEven"><code>{{ view_args|pprint }}</code></td>
<td class="djDebugOdd"><code>{{ view_kwargs|pprint }}</code></td>
<td class="djDebugEven"><code>{{ view_urlname }}</code></td>
</tr>
</tbody>
</table>
{% if cookies %}
<h4>{% trans "Cookies" %}</h4>
<table>
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>{% trans "Variable" %}</th>
<th>{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for key, value in cookies %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td><code>{{ key|pprint }}</code></td>
<td><code>{{ value|pprint }}</code></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h4>{% trans "No cookies" %}</h4>
{% endif %}
{% if session %}
<h4>{% trans "Session data" %}</h4>
<table>
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>{% trans "Variable" %}</th>
<th>{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for key, value in session %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td><code>{{ key|pprint }}</code></td>
<td><code>{{ value|pprint }}</code></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h4>{% trans "No session data" %}</h4>
{% endif %}
{% if get %}
<h4>{% trans "GET data" %}</h4>
<table>
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>{% trans "Variable" %}</th>
<th>{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for key, value in get %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td><code>{{ key|pprint }}</code></td>
<td><code>{{ value|pprint }}</code></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h4>{% trans "No GET data" %}</h4>
{% endif %}
{% if post %}
<h4>{% trans "POST data" %}</h4>
<table>
<colgroup>
<col style="width:20%"/>
<col/>
</colgr
<tr>
<th>{% trans "Variable" %}</th>
<th>{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for key, value in post %}
<tr class="{% cycle 'row1' 'row2' %}">
<td><code>{{ key|pprint }}</code></td>
<td><code>{{ value|pprint }}</code></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h4>{% trans "No POST data" %}</h4>
{% endif %}

@ -0,0 +1,17 @@
{% load i18n %}
<table>
<thead>
<tr>
<th>{% trans "Setting" %}</th>
<th>{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for name, value in settings.items %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ name }}</td>
<td><code>{{ value|pprint }}</code></td>
</tr>
{% endfor %}
</tbody>
</table>

@ -0,0 +1,19 @@
{% load i18n %}
<table>
<thead>
<tr>
<th>{% trans "Signal" %}</th>
<th>{% trans "Providing" %}</th>
<th>{% trans "Receivers" %}</th>
</tr>
</thead>
<tbody>
{% for name, signal, receivers in signals %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ name|escape }}</td>
<td>{{ signal.providing_args|join:", " }}</td>
<td>{{ receivers|join:", " }}</td>
</tr>
{% endfor %}
</tbody>
</table>

@ -0,0 +1,95 @@
{% load i18n l10n %}{% load static from staticfiles %}{% load url from future %}
<div class="djdt-clearfix">
<ul class="djdt-stats">
{% for alias, info in databases %}
<li>
<strong class="djdt-label"><span style="background-color: rgb({{ info.rgb_color|join:", " }})" class="djdt-color">&#160;</span> {{ alias }}</strong>
<span class="djdt-info">{{ info.time_spent|floatformat:"2" }} ms ({% blocktrans count info.num_queries as num %}{{ num }} query{% plural %}{{ num }} queries{% endblocktrans %})</span>
</li>
{% endfor %}
</ul>
</div>
{% if queries %}
<table>
<thead>
<tr>
<th class="djdt-color">&#160;</th>
<th class="query" colspan="2">{% trans "Query" %}</th>
<th class="timeline">{% trans "Timeline" %}</th>
<th class="djdt-time">{% trans "Time (ms)" %}</th>
<th class="djdt-actions">{% trans "Action" %}</th>
</tr>
</thead>
<tbody>
{% for query in queries %}
<tr class="djDebugHoverable {% cycle 'djDebugOdd' 'djDebugEven' %}{% if query.is_slow %} djDebugRowWarning{% endif %}{% if query.starts_trans %} djDebugStartTransaction{% endif %}{% if query.ends_trans %} djDebugEndTransaction{% endif %}{% if query.in_trans %} djDebugInTransaction{% endif %}" id="sqlMain_{{ forloop.counter }}">
<td class="djdt-color"><span style="background-color: rgb({{ query.rgb_color|join:", " }});">&#160;</span></td>
<td class="djdt-toggle">
<a class="djToggleSwitch" data-toggle-name="sqlMain" data-toggle-id="{{ forloop.counter }}" data-toggle-open="+" data-toggle-close="-" href="javascript:void(0)">+</a>
</td>
<td class="query">
<div class="djDebugSqlWrap">
<div class="djDebugSql">{{ query.sql|safe }}</div>
</div>
</td>
<td class="timeline">
<div class="djDebugTimeline"><div class="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %}" style="left:{{ query.start_offset|unlocalize }}%;"><strong style="width:{{ query.width_ratio_relative|unlocalize }}%; background-color:{{ query.trace_color }};">{{ query.width_ratio }}%</strong></div></div>
</td>
<td class="djdt-time">
{{ query.duration|floatformat:"2" }}
</td>
<td class="djdt-actions">
{% if query.params %}
{% if query.is_select %}
<form method="post">
{{ query.form }}
<button formaction="{% url 'djdt:sql_select' %}" class="remoteCall">Sel</button>
<button formaction="{% url 'djdt:sql_explain' %}" class="remoteCall">Expl</button>
{% if query.vendor == 'mysql' %}
<button formaction="{% url 'djdt:sql_profile' %}" class="remoteCall">Prof</button>
{% endif %}
</form>
{% endif %}
{% endif %}
</td>
</tr>
<tr class="djUnselected djDebugHoverable {% cycle 'djDebugOdd' 'djDebugEven' %}{% if query.is_slow %} djDebugRowWarning{% endif %} djToggleDetails_{{ forloop.counter }}" id="sqlDetails_{{ forloop.counter }}">
<td colspan="2"></td>
<td colspan="4">
<div class="djSQLDetailsDiv">
<p><strong>{% trans "Connection:" %}</strong> {{ query.alias }}</p>
{% if query.iso_level %}
<p><strong>{% trans "Isolation level:" %}</strong> {{ query.iso_level }}</p>
{% endif %}
{% if query.trans_status %}
<p><strong>{% trans "Transaction status:" %}</strong> {{ query.trans_status }}</p>
{% endif %}
{% if query.stacktrace %}
<pre class="djdt-stack">{{ query.stacktrace }}</pre>
{% endif %}
{% if query.template_info %}
<table>
{% for line in query.template_info.context %}
<tr>
<td>{{ line.num }}</td>
<td><code style="font-family: monospace;{% if line.highlight %}background-color: lightgrey{% endif %}">{{ line.content }}</code></td>
</tr>
{% endfor %}
</table>
<p><strong>{{ query.template_info.name|default:_("(unknown)") }}</strong></p>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "No SQL queries were recorded during this request." %}</p>
{% endif %}
<script src="{% static 'debug_toolbar/js/toolbar.sql.js' %}"></script>

@ -0,0 +1,37 @@
{% load i18n %}{% load static from staticfiles %}
<div class="djDebugPanelTitle">
<a class="djDebugClose djDebugBack" href=""></a>
<h3>{% trans "SQL explained" %}</h3>
</div>
<div class="djDebugPanelContent">
<div class="djdt-scroll">
<dl>
<dt>{% trans "Executed SQL" %}</dt>
<dd>{{ sql|safe }}</dd>
<dt>{% trans "Time" %}</dt>
<dd>{{ duration }} ms</dd>
<dt>{% trans "Database" %}</dt>
<dd>{{ alias }}</dd>
</dl>
<table class="djSqlExplain">
<thead>
<tr>
{% for h in headers %}
<th>{{ h|upper }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in result %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
{% for column in row %}
<td>{{ column|escape }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script src="{% static 'debug_toolbar/js/toolbar.sql.js' %}"></script>

@ -0,0 +1,44 @@
{% load i18n %}{% load static from staticfiles %}
<div class="djDebugPanelTitle">
<a class="djDebugClose djDebugBack" href=""></a>
<h3>{% trans "SQL profiled" %}</h3>
</div>
<div class="djDebugPanelContent">
<div class="djdt-scroll">
{% if result %}
<dl>
<dt>{% trans "Executed SQL" %}</dt>
<dd>{{ sql|safe }}</dd>
<dt>{% trans "Time" %}</dt>
<dd>{{ duration }} ms</dd>
<dt>{% trans "Database" %}</dt>
<dd>{{ alias }}</dd>
</dl>
<table class="djSqlProfile">
<thead>
<tr>
{% for h in headers %}
<th>{{ h|upper }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in result %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
{% for column in row %}
<td>{{ column|escape }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<dl>
<dt>{% trans "Error" %}</dt>
<dd>{{ result_error }}</dd>
</dl>
{% endif %}
</div>
</div>
<script src="{% static 'debug_toolbar/js/toolbar.sql.js' %}"></script>

@ -0,0 +1,41 @@
{% load i18n %}{% load static from staticfiles %}
<div class="djDebugPanelTitle">
<a class="djDebugClose djDebugBack" href=""></a>
<h3>{% trans "SQL selected" %}</h3>
</div>
<div class="djDebugPanelContent">
<div class="djdt-scroll">
<dl>
<dt>{% trans "Executed SQL" %}</dt>
<dd>{{ sql|safe }}</dd>
<dt>{% trans "Time" %}</dt>
<dd>{{ duration }} ms</dd>
<dt>{% trans "Database" %}</dt>
<dd>{{ alias }}</dd>
</dl>
{% if result %}
<table class="djSqlSelect">
<thead>
<tr>
{% for h in headers %}
<th>{{ h|upper }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in result %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
{% for column in row %}
<td>{{ column|escape }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "Empty set" %}</p>
{% endif %}
</div>
</div>
<script src="{% static 'debug_toolbar/js/toolbar.sql.js' %}"></script>

@ -0,0 +1,57 @@
{% load i18n %}
{% load static from staticfiles%}
<h4>{% blocktrans count staticfiles_dirs|length as dirs_count %}Static file path{% plural %}Static file paths{% endblocktrans %}</h4>
{% if staticfiles_dirs %}
<ol>
{% for prefix, staticfiles_dir in staticfiles_dirs %}
<li>{{ staticfiles_dir }}{% if prefix %} {% blocktrans %}(prefix {{ prefix }}){% endblocktrans %}{% endif %}</li>
{% endfor %}
</ol>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
<h4>{% blocktrans count staticfiles_apps|length as apps_count %}Static file app{% plural %}Static file apps{% endblocktrans %}</h4>
{% if staticfiles_apps %}
<ol>
{% for static_app in staticfiles_apps %}
<li>{{ static_app }}</li>
{% endfor %}
</ol>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
<h4>{% blocktrans count staticfiles|length as staticfiles_count %}Static file{% plural %}Static files{% endblocktrans %}</h4>
{% if staticfiles %}
<dl>
{% for staticfile in staticfiles %}
<dt><strong><a class="toggleTemplate" href="{{ staticfile.url }}">{{ staticfile }}</a></strong></dt>
<dd><samp>{{ staticfile.real_path }}</samp></dd>
{% endfor %}
</dl>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
{% for finder, payload in staticfiles_finders.items %}
<h4>{{ finder }} ({% blocktrans count payload|length as payload_count %}{{ payload_count }} file{% plural %}{{ payload_count }} files{% endblocktrans %})</h4>
<table>
<thead>
<tr>
<th>{% trans 'Path' %}</th>
<th>{% trans 'Location' %}</th>
</tr>
</thead>
<tbody>
{% for path, real_path in payload %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ path }}</td>
<td>{{ real_path }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}

@ -0,0 +1,14 @@
{% load i18n %}
<div class="djDebugPanelTitle">
<a class="djDebugClose djDebugBack" href=""></a>
<h3>{% trans "Template source:" %} <code>{{ template_name }}</code></h3>
</div>
<div class="djDebugPanelContent">
<div class="djdt-scroll">
{% if not source.pygmentized %}
<code>{{ source }}</code>
{% else %}
{{ source }}
{% endif %}
</div>
</div>

@ -0,0 +1,46 @@
{% load i18n %}{% load static from staticfiles %}{% load url from future %}
<h4>{% blocktrans count template_dirs|length as template_count %}Template path{% plural %}Template paths{% endblocktrans %}</h4>
{% if template_dirs %}
<ol>
{% for template in template_dirs %}
<li>{{ template }}</li>
{% endfor %}
</ol>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
<h4>{% blocktrans count templates|length as template_count %}Template{% plural %}Templates{% endblocktrans %}</h4>
{% if templates %}
<dl>
{% for template in templates %}
<dt><strong><a class="remoteCall toggleTemplate" href="{% url 'djdt:template_source' %}?template={{ template.template.name }}">{{ template.template.name|addslashes }}</a></strong></dt>
<dd><samp>{{ template.template.origin_name|addslashes }}</samp></dd>
{% if template.context %}
<dd>
<div class="djTemplateShowContextDiv"><a class="djTemplateShowContext"><span class="toggleArrow">&#x25B6;</span> {% trans "Toggle context" %}</a></div>
<div class="djTemplateHideContextDiv" style="display:none;"><code>{{ template.context }}</code></div>
</dd>
{% endif %}
{% endfor %}
</dl>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
<h4>{% blocktrans count context_processors|length as context_processors_count %}Context processor{% plural %}Context processors{% endblocktrans %}</h4>
{% if context_processors %}
<dl>
{% for key, value in context_processors.items %}
<dt><strong>{{ key|escape }}</strong></dt>
<dd>
<div class="djTemplateShowContextDiv"><a class="djTemplateShowContext"><span class="toggleArrow">&#x25B6;</span> {% trans "Toggle context" %}</a></div>
<div class="djTemplateHideContextDiv" style="display:none;"><code>{{ value|escape }}</code></div>
</dd>
{% endfor %}
</dl>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
<script src="{% static 'debug_toolbar/js/toolbar.template.js' %}"></script>

@ -0,0 +1,44 @@
{% load i18n %}{% load static from staticfiles %}
<h4>{% trans "Resource usage" %}</h4>
<table>
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>{% trans "Resource" %}</th>
<th>{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for key, value in rows %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ key|escape }}</td>
<td>{{ value|escape }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<!-- This hidden div is populated and displayed by code in toolbar.timer.js -->
<div id="djDebugBrowserTiming" style="display:none">
<h4>{% trans "Browser timing" %}</h4>
<table>
<colgroup>
<col style="width:20%"/>
<col style="width:60%"/>
<col style="width:20%"/>
</colgroup>
<thead>
<tr>
<th>{% trans "Timing attribute" %}</th>
<th class="timeline">{% trans "Timeline" %}</th>
<th class="djdt-time">{% trans "Milliseconds since navigation start (+length)" %}</th>
</tr>
</thead>
<tbody id="djDebugBrowserTimingTableBody">
</tbody>
</table>
</div>
<script src="{% static 'debug_toolbar/js/toolbar.timer.js' %}"></script>

@ -0,0 +1,17 @@
{% load i18n %}
<table>
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "Version" %}</th>
</tr>
</thead>
<tbody>
{% for package, version in versions.items %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ package }}</td>
<td>{{ version }}</td>
</tr>
{% endfor %}
</tbody>
</table>

@ -0,0 +1,16 @@
{% load i18n %}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>{{ status_line }}</h1>
<h2>{% trans "Location:" %} <a id="redirect_to" href="{{ redirect_to }}">{{ redirect_to }}</a></h2>
<p class="notice">
{% trans "The Django Debug Toolbar has intercepted a redirect to the above URL for debug viewing purposes. You can click the above link to continue with the redirect as normal." %}
</p>
<script type="text/javascript">
document.getElementById('redirect_to').focus();
</script>
</body>
</html>

@ -1,7 +1,7 @@
{% extends "base_catalog.html" %}
{% load i18n %}
{% block title %}Activation complete{% endblock %}
{% block title %}{% trans 'Активация завершена' %}{% endblock %}
{% block page_title %}
{% endblock %}
{% block content_list %}

@ -1 +1,2 @@
Activate your {{ site }} account - you have {{ expiration_days }} days!
{% load i18n %}
{% trans 'Активируйте ваш' %} {{ site }} {% trans 'акаунт - вы имеете' %} {{ expiration_days }} {% trans 'дня' %}

@ -0,0 +1,52 @@
from django.core.management.base import BaseCommand
from theme.models import Tag, Theme
import MySQLdb
from MySQLdb.cursors import DictCursor
class Command(BaseCommand):
def handle(self, *args, **options):
db = MySQLdb.connect(host="localhost",
user="expomap",
passwd="7FbLtAGjse",
db="old_db",
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
# id 3732 duplicate tag with bad name(2 spaces)
sql_tag = "SELECT id, title, url FROM tags WHERE id != 3732"
sql_theme = "SELECT categories_id as id, url FROM categories_description;"
cursor.execute(sql_theme)
res = cursor.fetchall()
"""
# themes
for item in res:
id = item['id']
old_url = item['url']
theme = Theme.objects.get(id=id)
theme.old_url = old_url
theme.save()
print(theme)
"""
# tags
cursor.execute(sql_tag)
res = cursor.fetchall()
updated_tags = []
for item in res:
id = item['id']
old_url = item['url']
title = item['title']
#print(id)
print(title.encode('utf8'))
try:
tag = Tag.objects.get(id=id, translations__name=title, translations__language_code='ru')
tag.old_url = old_url
updated_tags.append(id)
tag.save()
except Tag.DoesNotExist:
Tag.objects.exclude(id__in=updated_tags).filter(translations__name=title).update(old_url=old_url)
print(len(updated_tags))

@ -58,6 +58,7 @@ class Theme(TranslatableModel):
('webinar', 'Вебинар'),
)
url = models.SlugField(unique=True, max_length=255)
old_url = models.SlugField(unique=True, max_length=255)
types = BitField([k for k, v in FLAGS])
#translated fields
translations = TranslatedFields(
@ -71,6 +72,7 @@ class Theme(TranslatableModel):
)
main_page = models.PositiveIntegerField(default=0, db_index=True)
inflect = models.CharField(max_length=255, blank=True)
def __unicode__(self):
return self.lazy_translation_getter('name', unicode(self.pk))
@ -161,6 +163,7 @@ class Tag(TranslatableModel):
active = TagActiveManager()
url = models.SlugField(unique=True, max_length=255)
old_url = models.SlugField(unique=True, max_length=255)
theme = models.ForeignKey(Theme, on_delete=models.PROTECT, related_name='tags')
#translated fields
@ -174,6 +177,7 @@ class Tag(TranslatableModel):
keywords = models.CharField(max_length=250, blank=True),
)
inflect = models.CharField(max_length=255, blank=True)
#fields saves information about creating and changing model
#created = models.DateTimeField(auto_now_add=True)
#modified = models.DateTimeField(auto_now=True)

Loading…
Cancel
Save