remotes/origin/1203
pavel 11 years ago
parent 72592aacfd
commit e208b32f0d
  1. 50
      accounts/models.py
  2. 43
      article/management/commands/articles_from_old.py
  3. 59
      article/management/commands/news_from_old.py
  4. 62
      article/models.py
  5. 2
      article/urls.py
  6. 2
      article/views.py
  7. 6
      company/models.py
  8. 7
      core/simple_index_view.py
  9. 22
      exposition/admin.py
  10. 55
      exposition/forms.py
  11. 74
      exposition/management/commands/expo_test.py
  12. 31
      exposition/management/commands/fix_logo.py
  13. 65
      exposition/management/commands/imp_stat.py
  14. 19
      exposition/models.py
  15. 32
      proj/admin.py
  16. 2
      proj/admin_urls.py
  17. 12
      service/models.py
  18. 6
      service/order_forms.py
  19. 11
      service/urls.py
  20. 26
      service/views.py
  21. 30
      settings/templatetags/template_filters.py
  22. 47
      static/custom_js/main.js
  23. 17
      templates/admin/base.html
  24. 37
      templates/admin/exposition/exposition.html
  25. 58
      templates/admin/includes/stat_form.html
  26. 37
      templates/admin/service/order_list.html
  27. 4
      templates/client/article/article.html
  28. 8
      templates/client/article/blog_list.html
  29. 6
      templates/client/article/news_list.html
  30. 32
      templates/client/exposition/statistic.html
  31. 2
      templates/client/includes/accounts/current_user.html
  32. 2
      templates/client/includes/accounts/simple_user.html
  33. 6
      templates/client/includes/company/company_edit.html
  34. 12
      templates/client/includes/company/company_object.html
  35. 36
      templates/client/includes/exposition/statistic.html
  36. 4
      templates/client/popups/callback.html
  37. 1
      templates/client/static_client/css/main.css
  38. 3
      theme/views.py

@ -409,53 +409,3 @@ def post_profile(sender, instance, created, **kwargs):
post_save.connect(create_user_inf, sender=User) post_save.connect(create_user_inf, sender=User)
post_save.connect(post_profile, sender=Profile) post_save.connect(post_profile, sender=Profile)
#need import after User Model, because User imported in "organiser.models"
#from organiser.models import Organiser
'''
def create_profiles(sender, **kw):
"""
create Translator profile if "is_translator" field in User model true
if it's false delete Translator profile connected to User
create Organiser profile if "is_organiser" field in User model true
if it's false delete Organiser profile connected to User
"""
user = kw["instance"]
if user.is_translator and not user.translator.all():
#check flag is_translator and if translator profile already exist
translator = TranslatorProfile(user=user)
translator.save()
if not user.is_translator:
TranslatorProfile.objects.filter(user = user).delete()
if user.is_organiser and not user.organiser.all():
#check flag is_organiser and if organiser profile already exist
organiser = Organiser(user=user)
if user.country:
organiser.country = user.country
if user.city:
organiser.city = user.city
organiser.save()
data = {'name_ru':user.get_full_name()}
zero_fields = {}
fill_trans_fields_all(Organiser, organiser, data, None, zero_fields)
#populate empty fields and fields which was already populated
organiser_id = getattr(organiser, 'id')
populate_all(Organiser, data, organiser_id, zero_fields)
if not user.is_organiser:
Organiser.objects.filter(user = user).delete()
post_save.connect(create_profiles, sender=User)
'''

@ -4,6 +4,7 @@ from MySQLdb.cursors import DictCursor
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from functions.translate import fill_with_signal from functions.translate import fill_with_signal
from article.models import Article from article.models import Article
from accounts.models import User
class Command(BaseCommand): class Command(BaseCommand):
@ -15,8 +16,48 @@ class Command(BaseCommand):
charset='utf8', charset='utf8',
cursorclass=DictCursor) cursorclass=DictCursor)
cursor = db.cursor() cursor = db.cursor()
sql = """SELECT articles_description.articles_id as id , articles_description.articles_name as name, articles_description.articles_description as description, articles_description.articles_head_title_tag as title, articles_description.articles_head_desc_tag as descriptions, articles_description.articles_head_keywords_tag as keywords, articles_description.articles_intro as main_title, articles.articles_date_added as created, articles.articles_last_modified as modified
sql = """SELECT articles_description.articles_id as id ,
articles_description.articles_name as main_title,
articles_description.articles_description as description,
articles.authors_id as author,
articles_description.articles_intro as preview,
articles.articles_date_added as created,
articles.articles_last_modified as modified,
articles.articles_date_available as publish_date,
articles_description.articles_head_title_tag as title,
articles_description.articles_head_desc_tag as descriptions,
articles_description.articles_head_keywords_tag as keywords
FROM `articles_description` FROM `articles_description`
JOIN articles JOIN articles
ON articles_description.articles_id=articles.articles_id""" ON articles_description.articles_id=articles.articles_id"""
cursor.execute(sql)
result = cursor.fetchall()
user = User.objects.get(id=1)
Article.objects.blogs().delete()
for a in result:
article = Article(type=Article.blog,
id=a['id'],
created=a['created'],
modified=a['modified'],
publish_date=a['publish_date'])
article.author = user
article.translate('ru')
article.main_title = a['main_title']
article.preview = a['preview']
article.description = a['description']
article.title = a['title']
article.keywords = a['keywords']
if len(a['descriptions'])<255:
article.descriptions = a['descriptions']
article.save()
print(article)
#print(a['main_title'])

@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
import MySQLdb
from MySQLdb.cursors import DictCursor
from django.core.management.base import BaseCommand, CommandError
from functions.translate import fill_with_signal
from article.models import Article
from accounts.models import User
class Command(BaseCommand):
def handle(self, *args, **options):
db = MySQLdb.connect(host="localhost",
user="kotzilla",
passwd="qazedc",
db="old_expomap",
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
sql = """SELECT news_id as id ,
headline as main_title,
content as description,
cid as author,
date_added as created
FROM `latest_news`"""
cursor.execute(sql)
result = cursor.fetchall()
user = User.objects.get(id=1)
c = 0
for a in result:
if len(a['main_title'])>255 or not a['main_title']:
continue
article = Article(type=Article.news,
id=a['id'],
created=a['created'])
if a['author']:
try:
author = User.objects.get(id=a['author'])
except User.DoesNotExist:
author = user
else:
author = user
article.author = author
article.translate('ru')
article.main_title = a['main_title']
article.description = a['description']
article.save()
print(article)
#print(a['main_title'])

@ -81,9 +81,9 @@ class Article(TranslatableModel):
#translated fields #translated fields
translations = TranslatedFields( translations = TranslatedFields(
main_title = models.CharField(max_length=100), main_title = models.CharField(max_length=255),
preview = models.TextField(), preview = models.TextField(),
description = models.TextField(), description = models.TextField(blank=False),
#-----meta #-----meta
title = models.CharField(max_length=255, blank=True), title = models.CharField(max_length=255, blank=True),
descriptions = models.CharField(max_length=255, blank=True), descriptions = models.CharField(max_length=255, blank=True),
@ -121,8 +121,8 @@ class Article(TranslatableModel):
self.slug = self.generate_unique_slug() self.slug = self.generate_unique_slug()
#Set the description field on save. #Set the description field on save.
if self.gen_description: #if self.gen_description:
self.description = strip_tags(self.description_from_content()) # self.description = strip_tags(self.description_from_content())
super(Article, self).save(*args, **kwargs) super(Article, self).save(*args, **kwargs)
def description_from_content(self): def description_from_content(self):
@ -184,60 +184,6 @@ class Article(TranslatableModel):
""" """
return self._get_next_or_previous_by_publish_date(False, **kwargs) return self._get_next_or_previous_by_publish_date(False, **kwargs)
def clone(self):
"""
Return an identical copy of the instance with a new ID.
"""
if not self.pk:
raise ValueError('Instance must be saved before it can be cloned.')
duplicate = copy.copy(self)
# Setting pk to None. Django thinking this is a new object.
duplicate.pk = None
# url must be unique
duplicate.url += '_copy'
if Article.objects.safe_get(url=duplicate.url):
#already has copy this instance
return
ignore_fields = ['id', 'master', 'language_code']
duplicate.translate('ru')
tr = self._meta.translations_model.objects.get(language_code = 'ru',master__id=self.pk)
for field in duplicate._translated_field_names:
if field in ignore_fields:
continue
setattr(duplicate, field, getattr(tr, field))
duplicate.save()
# but lost all ManyToMany relations and Translations.
'''
# copy relations
for field in self._meta.many_to_many:
source = getattr(self, field.attname)
destination = getattr(duplicate, field.attname)
for item in source.all():
destination.add(item)
# copy translations
languages = self.get_available_languages()
ignore_fields = ['id', 'master', 'language_code']
for code in languages:
duplicate.translate(code)
tr = self._meta.translations_model.objects.get(language_code = code,master__id=self.pk)
for field in duplicate._translated_field_names:
if field in ignore_fields:
continue
setattr(duplicate, field, getattr(tr, field))
duplicate.save()
'''
return duplicate
def admin_url(self): def admin_url(self):
if self.type == 1: if self.type == 1:

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

@ -5,6 +5,7 @@ from models import Article
class NewsList(ListView): class NewsList(ListView):
model = Article model = Article
template_name = 'article/news_list.html' template_name = 'article/news_list.html'
paginate_by = 10
def get_queryset(self): def get_queryset(self):
if self.request.GET: if self.request.GET:
@ -30,6 +31,7 @@ class NewsDetail(DetailView):
class BlogList(ListView): class BlogList(ListView):
model = Article model = Article
template_name = 'article/blog_list.html' template_name = 'article/blog_list.html'
paginate_by = 10
def get_queryset(self): def get_queryset(self):
if self.request.GET: if self.request.GET:

@ -128,7 +128,13 @@ def calculate_rating(company):
if getattr(company, key): if getattr(company, key):
rating += value rating += value
themes = company.theme.all().count()
rating += themes * 10
tags = company.tag.all().count()
rating += tags * 10 if tags < 6 else 50
company.rating = rating company.rating = rating
# call to prevent recursion # call to prevent recursion
post_save.disconnect(create_company, sender=Company) post_save.disconnect(create_company, sender=Company)
company.save() company.save()

@ -1,7 +1,8 @@
import json import json
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.shortcuts import HttpResponse from django.shortcuts import HttpResponse
from forms import CallbackForm #from forms import CallbackForm
from service.order_forms import CallBackForm
class AdvertisingView(TemplateView): class AdvertisingView(TemplateView):
@ -15,9 +16,9 @@ class AboutView(TemplateView):
def callback(request): def callback(request):
response = {'success': False} response = {'success': False}
if request.GET: if request.GET:
form = CallbackForm(request.GET) form = CallBackForm(request.GET)
if form.is_valid(): if form.is_valid():
form.send() form.save()
response['success'] = True response['success'] = True
else: else:
response['errors'] = form.errors response['errors'] = form.errors

@ -241,11 +241,11 @@ class ExpositionView(AdminView):
template_name = 'admin/exposition/exposition.html' template_name = 'admin/exposition/exposition.html'
def form_valid(self, form): def form_valid(self, form):
StatisticFormSet = formset_factory(StatisticForm) #StatisticFormSet = formset_factory(StatisticForm)
formset_statistic = StatisticFormSet(self.request.POST) #formset_statistic = StatisticFormSet(self.request.POST)
self.set_obj() self.set_obj()
expo = form.save(obj=self.obj) expo = form.save(obj=self.obj)
"""
# delete old halls # delete old halls
Statistic.objects.filter(exposition=getattr(expo, 'id')).delete() Statistic.objects.filter(exposition=getattr(expo, 'id')).delete()
@ -255,7 +255,7 @@ class ExpositionView(AdminView):
statistic = item.save(commit=False) statistic = item.save(commit=False)
statistic.exposition = expo statistic.exposition = expo
statistic.save() statistic.save()
"""
return HttpResponseRedirect(self.success_url) return HttpResponseRedirect(self.success_url)
@ -331,20 +331,22 @@ class ExpositionView(AdminView):
context = super(ExpositionView, self).get_context_data(**kwargs) context = super(ExpositionView, self).get_context_data(**kwargs)
obj = self.set_obj() obj = self.set_obj()
if obj: if obj:
StatisticFormSet = modelformset_factory(Statistic, form=StatisticForm, exclude=('exposition',)) #StatisticFormSet = modelformset_factory(Statistic, form=StatisticForm, exclude=('exposition',))
# get existing statistic # get existing statistic
statistic = Statistic.objects.filter(exposition=getattr(obj, 'id')) #statistic = Statistic.objects.filter(exposition=getattr(obj, 'id'))
# fill HallFormSet # fill HallFormSet
formset_statistic = StatisticFormSet(queryset=statistic) #formset_statistic = StatisticFormSet(queryset=statistic)
context['stat_form'] = StatisticForm()
context['file_form'] = FileForm(initial={'model': 'exposition.Exposition'}) context['file_form'] = FileForm(initial={'model': 'exposition.Exposition'})
files = FileModel.objects.filter(content_type=ContentType.objects.get_for_model(obj),object_id=getattr(obj, 'id')) files = FileModel.objects.filter(content_type=ContentType.objects.get_for_model(obj),object_id=getattr(obj, 'id'))
context['files'] = files context['files'] = files
else: else:
StatisticFormSet = formset_factory(StatisticForm) #StatisticFormSet = formset_factory(StatisticForm)
formset_statistic = StatisticFormSet() #formset_statistic = StatisticFormSet()
pass
context['formset_statistic'] = formset_statistic #context['formset_statistic'] = formset_statistic
context['photo_form'] = PhotoForm() context['photo_form'] = PhotoForm()
context['timetable_form'] = TimeTableForm() context['timetable_form'] = TimeTableForm()

@ -462,14 +462,48 @@ class ExpositionDeleteForm(forms.ModelForm):
fields = ('url',) fields = ('url',)
class StatisticForm(forms.ModelForm): class StatisticForm(forms.Form):
year = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'})) year = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), label='Год')
visitors = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False) visitors = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False, label='Посетители')
members = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False) members = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False, label='Участники')
area = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False) area = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False, label='Площадь')
class Meta: countries_number = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False, label='Число стран')
model = Statistic
exclude = ('exposition') def __init__(self, *args, **kwargs):
"""
create dynamical translated fields fields
"""
super(StatisticForm, self).__init__(*args, **kwargs)
#creates translated forms example: name_ru, name_en
# len(10) is a hack for detect if settings.LANGUAGES is not configured it return all langs
if len(settings.LANGUAGES) in range(10):
for lid, (code, name) in enumerate(settings.LANGUAGES):
# uses enumerate for detect iteration number
# first iteration is a default lang so it required fields
required = True if lid == 0 else False
self.fields['countries_%s' % code] = forms.CharField(label=u'Участвующие страны',
required=False,
widget=forms.TextInput(attrs={'style':'width: 250px'}))
def save(self, exposition=None):
data = self.cleaned_data
if not exposition:
return None
else:
stat = Statistic()
# simple fields
stat.exposition = exposition
stat.year = data['year']
stat.visitors = data.get('visitors')
stat.members = data.get('members')
stat.area = data.get('area')
stat.countries_number = data.get('countries_number')
fill_with_signal(Statistic, stat, data)
return stat
def clean_year(self): def clean_year(self):
cleaned_data = super(StatisticForm, self).clean() cleaned_data = super(StatisticForm, self).clean()
@ -486,6 +520,11 @@ class StatisticForm(forms.ModelForm):
visitors = cleaned_data.get('visitors').strip() visitors = cleaned_data.get('visitors').strip()
return is_positive_integer(visitors) return is_positive_integer(visitors)
def clean_countries_number(self):
cleaned_data = super(StatisticForm, self).clean()
countries_number = cleaned_data.get('countries_number').strip()
return is_positive_integer(countries_number)
from functions.files import check_tmp_timetables from functions.files import check_tmp_timetables
class TimeTableForm(forms.Form): class TimeTableForm(forms.Form):

@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
import xlrd
import urllib2
from django.core.management.base import BaseCommand
from django.conf import settings
from functions.form_check import translit_with_separator
from functions.files import get_alternative_filename
from exposition.models import Exposition, Statistic
from organiser.models import Organiser
CHINA_FILE = settings.MEDIA_ROOT+'/import/expo_china_ru.xlsx'
GERMANY_FILE = settings.MEDIA_ROOT+'/import/expo_germany_ru.xlsx'
# 391 row not imported(same url)
ITALY_FILE = settings.MEDIA_ROOT+'/import/expo_italy_ru.xlsx'
# moscow 3 exps
F = settings.MEDIA_ROOT+'/import/exp.xlsx'
LA_FILE = settings.MEDIA_ROOT+'/import/expo_la.xlsx'
NA_EU_ASIA_FILE = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa.xls'
NA_EU_ASIA_FILE2 = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa_part2.xls'
# 44
class Command(BaseCommand):
def handle(self, *args, **options):
qs = Statistic.objects.language('ru').exclude(translations__countries='')
comas = 0
enters = 0
main = 0
spaces = 0
word = 0
number = 0
for i in qs:
if ';' in i.countries:
main +=1
a = i.countries.split(';')
new = [item.strip() for item in a]
st = ';'.join(new)
print st.encode('utf8')
i.countries = st
#i.save()
elif ',' in i.countries:
comas += 1
elif '\n' in i.countries:
enters += 1
elif ' ' in i.countries:
spaces += 1
if '55' in i.countries:
continue
elif '.' in i.countries:
number += 1
#a = i.countries.split('.')
#i.countries_number = int(a[0])
#i.countries = ''
#i.save()
else:
word += 1
print('all: %d'%qs.count())
print('main: %d'%main)
print('comas: %d'%comas)
print('enter: %d'%enters)
print('spaces: %d'%spaces)
print('word: %d'%word)
print('number: %d'%number)

@ -24,7 +24,7 @@ NA_EU_ASIA_FILE2 = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa_part2.xls'
class Command(BaseCommand): class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
f = open(NA_EU_ASIA_FILE2, 'r') f = open(CHINA_FILE, 'r')
book = xlrd.open_workbook(file_contents=f.read()) book = xlrd.open_workbook(file_contents=f.read())
sheet = book.sheet_by_index(0) sheet = book.sheet_by_index(0)
row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)] row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)]
@ -37,25 +37,40 @@ class Command(BaseCommand):
except Exposition.DoesNotExist: except Exposition.DoesNotExist:
continue continue
if row[16] =='' or row[16].startswith('http') or row[16].startswith('https') or row[16].startswith('/') or row[16].startswith('../'): if exp.logo or row[19] == '':# or row[16].startswith('http') or row[16].startswith('https') or not row[16].startswith('/') or row[16].startswith('../'):
continue continue
path = row[16] path = row[19]
file_name = path.split('/')[-1] file_name = path.split('/')[-1]
logo_path = exp.logo.field.upload_to logo_path = exp.logo.field.upload_to
full_path = settings.MEDIA_ROOT + logo_path full_path = settings.MEDIA_ROOT + logo_path
try:
alt_name = get_alternative_filename(full_path, file_name) alt_name = get_alternative_filename(full_path, file_name)
except UnicodeEncodeError:
continue
download_to = full_path+alt_name download_to = full_path+alt_name
url = 'http://expomap.ru/' + path
if path.startswith('http') or path.startswith('https'):
url = path
elif path.startswith('/'):
url = 'http://expomap.ru' + path
elif path.startswith('images'):
url = 'http://expomap.ru/' + path
else:
continue
#print('------------------------------------')
#print(path)
#print(url)
#print('------------------------------------')
try: try:
response = urllib2.urlopen(url, timeout=15) response = urllib2.urlopen(url, timeout=15)
except: except:
continue continue
if response.code != 200:
continue
with open(download_to,'wb') as f: with open(download_to,'wb') as f:
try: try:

@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
import xlrd
import urllib2
from django.core.management.base import BaseCommand
from django.conf import settings
from functions.form_check import translit_with_separator
from functions.files import get_alternative_filename
from exposition.models import Exposition, Statistic
from organiser.models import Organiser
CHINA_FILE = settings.MEDIA_ROOT+'/import/expo_china_ru.xlsx'
GERMANY_FILE = settings.MEDIA_ROOT+'/import/expo_germany_ru.xlsx'
# 391 row not imported(same url)
ITALY_FILE = settings.MEDIA_ROOT+'/import/expo_italy_ru.xlsx'
# moscow 3 exps
F = settings.MEDIA_ROOT+'/import/exp.xlsx'
LA_FILE = settings.MEDIA_ROOT+'/import/expo_la.xlsx'
NA_EU_ASIA_FILE = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa.xls'
NA_EU_ASIA_FILE2 = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa_part2.xls'
class Command(BaseCommand):
def handle(self, *args, **options):
f = open(NA_EU_ASIA_FILE, 'r')
book = xlrd.open_workbook(file_contents=f.read())
sheet = book.sheet_by_index(0)
row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)]
labels = [label for label in row_list[0]]
for row_number, row in enumerate(row_list[1:]):
exp_url = translit_with_separator(row[2])
try:
exp = Exposition.objects.language('ru').get(url=exp_url)
except Exposition.DoesNotExist:
continue
if not row[30]:
continue
year = int(row[30])
try:
countries_number = int(exp.stat_countries)
countries = ''
except ValueError:
countries_number = None
countries = exp.stat_countries
members = exp.members
visitors = exp.visitors
area = exp.area
s = Statistic(exposition=exp,
year=year,
countries_number=countries_number,
members=members,
visitors=visitors,
area=area)
s.translate('ru')
s.countries = countries
s.save()
print(exp)

@ -327,12 +327,22 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
return duplicate return duplicate
class Statistic(models.Model): class Statistic(TranslatableModel):
exposition = models.ForeignKey(Exposition, related_name='statistic') exposition = models.ForeignKey(Exposition, related_name='statistic')
year = models.PositiveIntegerField(verbose_name='Год') year = models.PositiveIntegerField(verbose_name='Год')
members = models.PositiveIntegerField(verbose_name='Посетители') members = models.PositiveIntegerField(verbose_name='Посетители', blank=True, null=True)
visitors = models.PositiveIntegerField(verbose_name='Участники') visitors = models.PositiveIntegerField(verbose_name='Участники', blank=True, null=True)
area = models.PositiveIntegerField(verbose_name='Площадь') area = models.PositiveIntegerField(verbose_name='Площадь', blank=True, null=True)
countries_number = models.PositiveIntegerField(verbose_name='Количество стран', blank=True, null=True)
translations = TranslatedFields(
countries = models.TextField(blank=True)
)
def to_dict(self):
return hvad_to_dict(self)
from django.core import serializers from django.core import serializers
from functions.models_methods import hvad_to_dict from functions.models_methods import hvad_to_dict
@ -410,3 +420,4 @@ pre_save.connect(pre_save_handler, sender=Exposition)
post_save.connect(post_save_handler, sender=Exposition) post_save.connect(post_save_handler, sender=Exposition)
post_save.connect(post_save_handler, sender=TimeTable) post_save.connect(post_save_handler, sender=TimeTable)
post_save.connect(post_save_handler, sender=TmpTimeTable) post_save.connect(post_save_handler, sender=TmpTimeTable)
post_save.connect(post_save_handler, sender=Statistic)

@ -159,6 +159,38 @@ def ajax_post_timetable(request, obj_id=None):
else: else:
return HttpResponse('error') return HttpResponse('error')
from exposition.models import Statistic
from exposition.forms import StatisticForm
def ajax_post_stat(request, obj_id=None):
response = {'success': False}
if request.GET:
form = StatisticForm(request.GET)
if form.is_valid():
exp = Exposition.objects.safe_get(id=obj_id)
if exp:
form.save(exp)
response['success'] = True
else:
response.update({'errors': form.errors})
return HttpResponse(json.dumps(response), content_type='application/json')
def ajax_delete_stat(request, id):
redirect_to = request.META.get('HTTP_REFERER')
if id:
try:
Statistic.objects.get(id=id).delete()
except Statistic.DoesNotExist:
pass
return HttpResponseRedirect(redirect_to)
def ajax_delete_timetable(request): def ajax_delete_timetable(request):
if request.GET: if request.GET:

@ -36,6 +36,8 @@ urlpatterns = required(
url(r'^ajax_post_file/', 'proj.admin.ajax_post_file'), url(r'^ajax_post_file/', 'proj.admin.ajax_post_file'),
url(r'^ajax_post_photo/(?P<obj_id>\d+)/$', 'proj.admin.ajax_post_photo'),#must be before /ajax_post_photo/ url(r'^ajax_post_photo/(?P<obj_id>\d+)/$', 'proj.admin.ajax_post_photo'),#must be before /ajax_post_photo/
url(r'^ajax_post_photo/', 'proj.admin.ajax_post_photo'), url(r'^ajax_post_photo/', 'proj.admin.ajax_post_photo'),
url(r'^ajax_post_stat/(?P<obj_id>\d+)/$', 'proj.admin.ajax_post_stat'),
url(r'^ajax_delete_stat/(?P<id>\d+)/', 'proj.admin.ajax_delete_stat'),
url(r'^ajax_post_timetable/(?P<obj_id>\d+)/$', 'proj.admin.ajax_post_timetable'),#must be before /ajax_post_timetable/ url(r'^ajax_post_timetable/(?P<obj_id>\d+)/$', 'proj.admin.ajax_post_timetable'),#must be before /ajax_post_timetable/
url(r'^ajax_post_timetable/', 'proj.admin.ajax_post_timetable'), url(r'^ajax_post_timetable/', 'proj.admin.ajax_post_timetable'),
url(r'^ajax_delete_timetable/', 'proj.admin.ajax_delete_timetable'), url(r'^ajax_delete_timetable/', 'proj.admin.ajax_delete_timetable'),

@ -65,9 +65,12 @@ class AbstractOrder(models.Model):
exposition = models.ForeignKey('exposition.Exposition', null=True) exposition = models.ForeignKey('exposition.Exposition', null=True)
conference = models.ForeignKey('conference.Conference', null=True) conference = models.ForeignKey('conference.Conference', null=True)
seminar = models.ForeignKey('seminar.Seminar', null=True) seminar = models.ForeignKey('seminar.Seminar', null=True)
created = models.DateTimeField(auto_now_add=True)
viewed = models.DateTimeField(null=True, blank=True)
class Meta: class Meta:
abstract = True abstract = True
ordering = ['-created']
@ -125,3 +128,12 @@ class Visit(AbstractOrder):
class Advertising(AbstractOrder): class Advertising(AbstractOrder):
pass pass
class CallBack(models.Model):
phone = models.CharField(max_length=30)
person_inf = models.CharField(max_length=255)
created = models.DateTimeField(auto_now_add=True)
viewed = models.DateTimeField(null=True, blank=True)
class Meta:
ordering = ['-created']

@ -2,7 +2,7 @@
from django import forms from django import forms
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from accounts.models import User from accounts.models import User
from models import Catalog, Tickets, Remote, Participation, Translation, Visit, CURENCIES, Advertising from models import Catalog, Tickets, Remote, Participation, Translation, Visit, CURENCIES, Advertising, CallBack
from exposition.models import Exposition from exposition.models import Exposition
from conference.models import Conference from conference.models import Conference
from seminar.models import Seminar from seminar.models import Seminar
@ -202,3 +202,7 @@ class AdvertiseForm(AbstractOrderForm):
class Meta: class Meta:
model = Advertising model = Advertising
class CallBackForm(forms.ModelForm):
class Meta:
model = CallBack
fields=('phone', 'person_inf')

@ -1,10 +1,19 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from views import ServiceView from views import ServiceView, CallBackListView, VisitListView, TranslationListView, AdvertisingListView, \
ParticipationListView, RemoteListView,TicketsListView
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'service/order/callback/$', CallBackListView.as_view()),
url(r'service/order/visit/$', VisitListView.as_view()),
url(r'service/order/translation/$', TranslationListView.as_view()),
url(r'service/order/advertising/$', AdvertisingListView.as_view()),
url(r'service/order/participation/$', ParticipationListView.as_view()),
url(r'service/order/remote/$', RemoteListView.as_view()),
url(r'service/order/tickets/$', TicketsListView.as_view()),
url(r'service/advertise/$', 'service.views.advertise'), url(r'service/advertise/$', 'service.views.advertise'),
url(r'service/(?P<url>.*)/$', ServiceView.as_view()), url(r'service/(?P<url>.*)/$', ServiceView.as_view()),
) )

@ -48,5 +48,31 @@ def advertise(request):
return HttpResponse(json.dumps(response), content_type='application/json') return HttpResponse(json.dumps(response), content_type='application/json')
from service.models import CallBack, Visit, Translation, Advertising, Participation, Remote, Tickets
class AbstractOrderListView(ListView):
template_name = 'admin/service/order_list.html'
paginate_by = 20
class CallBackListView(AbstractOrderListView):
model = CallBack
class VisitListView(AbstractOrderListView):
model = Visit
class TranslationListView(AbstractOrderListView):
model = Translation
class AdvertisingListView(AbstractOrderListView):
model = Advertising
class ParticipationListView(AbstractOrderListView):
model = Participation
class RemoteListView(AbstractOrderListView):
model = Remote
class TicketsListView(AbstractOrderListView):
model = Tickets

@ -247,3 +247,33 @@ def in_events(day, events):
@register.filter @register.filter
def base64_encode(value): def base64_encode(value):
return base64.b64encode(value) return base64.b64encode(value)
@register.filter
def generate_countries_list(value):
values = value.split(';')
values.sort()
if len(values) >= 2:
ul1 = values[::3]
ul2 = values[1::3]
ul3 = values[2::3]
elif len(values) >= 2:
ul1 = values[::2]
ul2 = values[1::2]
ul3 = []
else:
ul1 = values
ul2 = []
ul3 = []
ul1_html = ''.join(['<li>%s</li>'%i for i in ul1])
ul2_html = ''.join(['<li>%s</li>'%i for i in ul2])
ul3_html = ''.join(['<li>%s</li>'%i for i in ul3])
ul1 ='<ul>' + ul1_html + '</ul>'
ul2 ='<ul>' + ul2_html + '</ul>'
ul3 ='<ul>' + ul3_html + '</ul>'
return ul1+ul2+ul3

@ -86,6 +86,30 @@ function postTimetable(data, textStatus){
} }
} }
function postStat(data, textStatus){
if(data.success){
location.reload;
}
else{
$.each(data.errors, function(field_name, errors){
$('#id_'+field_name).parent().parent().addClass('error');
})
}
/*
if (data instanceof Object){
$.each(data, function(field_name, errors){
$('#id_'+field_name).parent().parent().addClass('error');
})
}
else{
$('#stat_modal table tbody').html(data);
$('#stat_form')[0].reset();
$('#stat_form .control-group').removeClass('error');
$('#close_stat').click();
}
*/
}
$(document).ready(function(){ $(document).ready(function(){
@ -350,6 +374,29 @@ $(document).ready(function(){
});//end get });//end get
});//end change });//end change
$('#stat_form').on('submit', function(e){//submit(function(){
e.preventDefault();
var url = '/admin/ajax_post_stat/' + $('#obj_id').val() + '/';
console.log(url)
var formData = $(this).serialize();
$.ajax({
url: url, //server script to process data
type: 'GET',
//Ajax events
success: postStat,
error: function(){ alert('error'); },
// Form data
data: formData,
//Options to tell JQuery not to process data or worry about content-type
cache: false,
contentType: false,
processData: false
});//end ajax
}); // end submit
$('#timetable_form').on('submit', function(e){//submit(function(){ $('#timetable_form').on('submit', function(e){//submit(function(){
e.preventDefault(); e.preventDefault();
tinyMCE.triggerSave(); tinyMCE.triggerSave();

@ -112,8 +112,8 @@
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list"></i> Справочники<b class="caret"></b></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list"></i> Справочники<b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="/admin/article/blog/all">Статьи</a></li> <li><a href="/admin/article/blog/all/">Статьи</a></li>
<li><a href="/admin/article/news/all">Новости</a></li> <li><a href="/admin/article/news/all/">Новости</a></li>
<li><a href="#">Отзывы</a></li> <li><a href="#">Отзывы</a></li>
<li><a href="/admin/language/add">Языки</a></li> <li><a href="/admin/language/add">Языки</a></li>
<li><a href="/admin/currency/add">Валюты</a></li> <li><a href="/admin/currency/add">Валюты</a></li>
@ -145,6 +145,19 @@
</ul> </ul>
</li> </li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class=" icon-circle-arrow-up"></i> Заказы<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/admin/service/order/callback/">Обратный звонок</a></li>
<li><a href="/admin/service/order/visit/">Бизнес-тур под ключ</a></li>
<li><a href="/admin/service/order/translation/">Переводчик</a></li>
<li><a href="/admin/service/order/advertising/">Рекламировать</a></li>
<li><a href="/admin/service/order/participation/">Участие</a></li>
<li><a href="/admin/service/order/remote/">Заочное посещение</a></li>
<li><a href="/admin/service/order/tickets/">Билеты</a></li>
</ul>
</li>
</ul> </ul>
</div> </div>

@ -494,6 +494,39 @@
</div> </div>
</div> </div>
{% if object %}
<div style="padding-left: 160px;{% if object %} {% else %}display: none;{% endif %}">
<table class="table table-hover" style=" width: 100%;">
<thead>
<tr>
<td>Год</td>
<td>Посетители</td>
<td>Участники</td>
<td>Площадь</td>
<td></td>
</tr>
</thead>
<tbody>
{% for stat in object.statistic.all %}
<tr>
<td>{{ stat.year }}</td>
<td>{{ stat.visitors }}</td>
<td>{{ stat.members }}</td>
<td>{{ stat.area }}</td>
<td><a class="btn btn-danger delete_stat" href="/admin/ajax_delete_stat/{{ stat.id }}/"><i class="icon-trash icon-white"></i> Удалить</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<a href="#stat_modal" id="stat_add" role="btn btn-success" class="btn btn-success" data-toggle="modal"><i class="icon-plus-sign icon-white"></i> Добавить год</a>
</div>
{% else %}
{% endif %}
{% comment %}
{% if formset_statistic.errors %} {% if formset_statistic.errors %}
<div class="alert alert-error"> <div class="alert alert-error">
{% for form in formset_statistic.forms %} {% for form in formset_statistic.forms %}
@ -536,6 +569,7 @@
</div> </div>
<p style=" padding-left: 20px"><a id="add" class="btn btn-success" href="#"><i class="icon-plus-sign icon-white"></i> Добавить год</a></p> <p style=" padding-left: 20px"><a id="add" class="btn btn-success" href="#"><i class="icon-plus-sign icon-white"></i> Добавить год</a></p>
</div> </div>
{% endcomment %}
</div> </div>
<div class="box span8" id="file"> <div class="box span8" id="file">
<div class="box-header well"> <div class="box-header well">
@ -647,7 +681,7 @@
<div class="modal-footer"> <div class="modal-footer">
<div class="controls"> <div class="controls">
<input class="btn btn-primary" type="submit" value="Добавить"> <input class="btn btn-primary" type="submit" value="{% if object %}Изменить{% else %}Добавить{% endif %}">
<input type="reset" class="btn" value="Отменить" data-dismiss="modal"> <input type="reset" class="btn" value="Отменить" data-dismiss="modal">
</div> </div>
@ -659,4 +693,5 @@
</div> </div>
{% include 'admin/includes/photo_form.html' with form=photo_form object=object %} {% include 'admin/includes/photo_form.html' with form=photo_form object=object %}
{% include 'admin/includes/file_form.html' with file_form=file_form object=object %} {% include 'admin/includes/file_form.html' with file_form=file_form object=object %}
{% include 'admin/includes/stat_form.html' with form=stat_form object=object %}
{% endblock %} {% endblock %}

@ -0,0 +1,58 @@
<div class="modal hide fade bs-example-modal-lg" id="stat_modal" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="close_stat">&times;</button>
<h3>Добавить год</h3>
</div>
<form method="post" class="form-horizontal" id="stat_form" enctype="multipart/form-data" action="#"> {% csrf_token %}
<div class="modal-body">
<div class="control-group{% if form.year.errors %}error{% endif %}">
<label class="control-label">{{ form.year.label }}:</label>
<div class="controls">{{ form.year }}
<span class="help-inline">{{ form.year.errors }}</span>
</div>
</div>
<div class="control-group{% if form.members.errors %}error{% endif %}">
<label class="control-label">{{ form.members.label }}:</label>
<div class="controls">{{ form.members }}
<span class="help-inline">{{ form.members.errors }}</span>
</div>
</div>
<div class="control-group{% if form.visitors.errors %}error{% endif %}">
<label class="control-label">{{ form.visitors.label }}:</label>
<div class="controls">{{ form.visitors }}
<span class="help-inline">{{ form.visitors.errors }}</span>
</div>
</div>
<div class="control-group{% if form.area.errors %}error{% endif %}">
<label class="control-label">{{ form.area.label }}:</label>
<div class="controls">{{ form.area }}
<span class="help-inline">{{ form.area.errors }}</span>
</div>
</div>
<div class="control-group{% if form.countries_number.errors %}error{% endif %}">
<label class="control-label">{{ form.countries_number.label }}:</label>
<div class="controls">{{ form.countries_number }}
<span class="help-inline">{{ form.countries_number.errors }}</span>
</div>
</div>
{% include 'admin/forms/multilang.html' with field='countries' form=form languages=languages %}
</div>
<div class="modal-footer">
<div class="controls">
<input class="btn btn-primary" type="submit" value="Добавить">
<input type="reset" class="btn" value="Отменить" data-dismiss="modal">
</div>
</div>
</form>
</div>

@ -0,0 +1,37 @@
{% extends 'base.html' %}
{% block body %}
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-arrow-down"></i>Список заказов</h2>
</div>
<div class="box-content">
<table class="table table-hover">
<thead>
<tr>
<th>id</th>
<th>Контактное лицо</th>
<th>Телефон</th>
<th>Время создания</th>
</tr>
</thead>
<tbody>
{% for item in object_list %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.person_inf }}</td>
<td>{{ item.phone }}</td>
<td>{{ item.created }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% include 'admin/includes/admin_pagination.html' with page_obj=page_obj %}
</div>
{# pagination #}
{% endblock %}

@ -19,8 +19,8 @@
{% include 'includes/article/article_logo.html' with obj=object %} {% include 'includes/article/article_logo.html' with obj=object %}
<h1>{{ object.main_title }}</h1> <h1>{{ object.main_title }}</h1>
<strong><span>{{ object.publish_date }}</span><a class="profile_link" href="{{ object.author.get_permanent_url }}" title="">{{ object.author.get_full_name }}</a></strong> <strong><span>{{ object.created }}</span><a class="profile_link" href="{{ object.author.get_permanent_url }}" title="">{{ object.author.get_full_name }}</a></strong>
{{ object.description }} {{ object.description|safe }}
<div class="blog_avtor"> <div class="blog_avtor">
<table> <table>

@ -12,7 +12,7 @@
{% block page_title %} {% block page_title %}
<div class="page-title"> <div class="page-title">
<h1>{% trans 'Статьи' %}:</h1> <h1>{% trans 'Статьи' %}</h1>
</div> </div>
{% endblock %} {% endblock %}
@ -105,7 +105,7 @@
<h3><a href="{{ blog.get_permanent_url }}" title="">{{ blog.main_title }}</a></h3> <h3><a href="{{ blog.get_permanent_url }}" title="">{{ blog.main_title }}</a></h3>
{{ blog.preview }} {{ blog.preview }}
<strong><span>{{ blog.publish_date }}</span>{% include 'includes/article_tags.html' with obj=blog %}</strong> <strong><span>{{ blog.created|date:"d E Y" }}</span>{% if blog.tag.all.exists %}{% include 'includes/article_tags.html' with obj=blog %}{% endif %}</strong>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
@ -113,3 +113,7 @@
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block paginator %}
{% include 'includes/catalog_paginator.html' with page_obj=page_obj %}
{% endblock %}

@ -103,10 +103,14 @@
{% include 'includes/article/news_preview.html' with obj=news %}</a> {% include 'includes/article/news_preview.html' with obj=news %}</a>
<h3><a href="{{ news.get_permanent_url }}" title="">{{ news.main_title }}</a></h3> <h3><a href="{{ news.get_permanent_url }}" title="">{{ news.main_title }}</a></h3>
{{ news.preview }} {{ news.preview }}
<strong><span>{{ news.publish_date }}</span><a href="{{ news.get_event.get_permanent_url }}" title=""><b>{{ news.get_event }}</b></a></strong> <strong><span>{{ news.created|date:"d E Y" }}</span>{% with event=news.get_event %}{% if event %}<a href="{{ event.get_permanent_url }}" title=""><b>{{ event.name }}</b></a>{% endif %}{% endwith %}</strong>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block paginator %}
{% include 'includes/catalog_paginator.html' with page_obj=page_obj %}
{% endblock %}

@ -1,4 +1,5 @@
{% extends 'base_catalog.html' %} {% extends 'base_catalog.html' %}
{% load static %}
{% load template_filters %} {% load template_filters %}
{% load i18n %} {% load i18n %}
@ -19,8 +20,39 @@
{% block content_list %} {% block content_list %}
{% include 'client/includes/exposition/statistic.html' with exposition=object %} {% include 'client/includes/exposition/statistic.html' with exposition=object %}
<script>
$('a.eps-open').on('click', function () {
var $switch = $(this);
var $sect = $switch.closest('.ep-sect');
var $sectBody = $sect.children('div.ep-sect-body');
if ($sect.hasClass('eps-opened')) {
$sectBody
.stop()
.animate({
height: 'hide',
opacity: 'hide'
}, 300, function () {
$sect.removeClass('eps-opened');
});
} else {
$sectBody
.stop()
.animate({
height: 'show',
opacity: 'show'
}, 300, function () {
$sect.addClass('eps-opened');
});
}
return false;
});
</script>
{% endblock %} {% endblock %}
{% block paginator %} {% block paginator %}
{% endblock %} {% endblock %}

@ -438,7 +438,7 @@
<div class="add_link_text_text">{% trans 'информацию о себе' %} <b>+10</b></div> <div class="add_link_text_text">{% trans 'информацию о себе' %} <b>+10</b></div>
</div> </div>
<div class="p-editable editable-wrap {% if about_form.about.value %}{% else %}hidden{% endif %}"> <div class="p-editable editable-wrap {% if about_form.about.value %}{% else %}hidden{% endif %}">
<p id="static-about-value" class="static-value">{{ about_form.about.value }}</p> <p id="static-about-value" class="static-value">{{ about_form.about.value|linebreaks }}</p>
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn fa fa-pencil-square-o" href="javascript:void(0);">{% trans 'редактировать' %}</a> <a class="e-btn fa fa-pencil-square-o" href="javascript:void(0);">{% trans 'редактировать' %}</a>

@ -35,7 +35,7 @@
</div> </div>
<div class="i-descr"> <div class="i-descr">
{{ member.profile.about_company|safe }} {{ member.profile.about_company|safe|linebreaks }}
</div> </div>
<hr /> <hr />

@ -158,7 +158,8 @@
<div class="add_link_text_text">{% trans 'краткое описание компании' %} <b>+20</b></div> <div class="add_link_text_text">{% trans 'краткое описание компании' %} <b>+20</b></div>
</div> </div>
<div class="i-position p-editable editable-wrap {% if spec_form.specialization %}{% else %}hidden{% endif %} required"> <div class="i-position p-editable editable-wrap {% if spec_form.specialization %}{% else %}hidden{% endif %} required">
<span id="static-spec-value" class="static-value min-height">{{ spec_form.specialization.value }}&nbsp;</span> <span id="static-spec-value" class="static-value min-height">{{ spec_form.specialization.value|linebreaks }}&nbsp;</span>
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn fa fa-pencil-square-o" href="javascript:void(0);">{% trans 'редактировать' %}</a> <a class="e-btn fa fa-pencil-square-o" href="javascript:void(0);">{% trans 'редактировать' %}</a>
@ -611,8 +612,10 @@
</dl> </dl>
<!-- !!! --> <!-- !!! -->
</div> </div>
<a rel="nofollow" id="profile-preview-btn" class="button profile-preview-btn" href="javascript:void(0);" target="_blank">Предварительный просмотр <i class="fa fa-eye"></i></a> <a rel="nofollow" id="profile-preview-btn" class="button profile-preview-btn" href="javascript:void(0);" target="_blank">Предварительный просмотр <i class="fa fa-eye"></i></a>
</div> </div>
</div> </div>
</div> </div>
@ -648,7 +651,6 @@
avatarImageClass:'user-avatar', avatarImageClass:'user-avatar',
avatarInputId:"id_avatar", avatarInputId:"id_avatar",
noImageSrc:"{% static 'client/img/no-logo.png' %}", noImageSrc:"{% static 'client/img/no-logo.png' %}",
previewBtnId:"profile-preview-btn",
// text and paths for dynamically rendered selectboxes // text and paths for dynamically rendered selectboxes
selectBox:[ selectBox:[

@ -22,9 +22,7 @@
<div class="i-title">{{ company.name|safe }}</div> <div class="i-title">{{ company.name|safe }}</div>
</header> </header>
<div class="i-area specialization"> <div class="i-area"><a href="#">{{ company.specialization|linebreaks }}</a></div>
{{ company.specialization }}
</div>
{% with themes=company.theme.all %} {% with themes=company.theme.all %}
<div class="i-area" id="theme-inf" data-theme="{% for th in themes %}{{ th.id }},{% endfor %}"> <div class="i-area" id="theme-inf" data-theme="{% for th in themes %}{{ th.id }},{% endfor %}">
{% for th in themes %} {% for th in themes %}
@ -43,11 +41,8 @@
{% endwith %} {% endwith %}
</div> </div>
{% if company.address_inf %} <hr />
{{ company.address_inf }}
<hr />
{{ company.address_inf }}
{% endif %}
<hr /> <hr />
@ -152,6 +147,7 @@
</div> </div>
</header> </header>
{% endif %} {% endif %}
<ul class="cat-list cl-exhibitions"> <ul class="cat-list cl-exhibitions">

@ -1,4 +1,5 @@
{% load i18n %} {% load i18n %}
{% load template_filters %}
<div class="m-article"> <div class="m-article">
<div class="item-wrap event clearfix"> <div class="item-wrap event clearfix">
@ -85,12 +86,12 @@
</div> </div>
<div class="eps-item"> <div class="eps-item">
<b>{{ st.members }}</b> <b>{{ st.members }}</b>
<div class="eps-text">{% trans 'учасников' %}</div> <div class="eps-text">{% trans 'участников' %}</div>
</div> </div>
</div> </div>
<div class="ep-info clearfix"> <div class="ep-info clearfix">
{% if exposition.place %} {% if st.area %}
<div class="ep-area-wrap"> <div class="ep-area-wrap">
<div class="epa-title">{% trans 'Общая выставочная площадь' %}</div> <div class="epa-title">{% trans 'Общая выставочная площадь' %}</div>
@ -101,39 +102,26 @@
<div class="ep-founded"><b>{{ exposition.foundation_year }}</b> год основания</div> <div class="ep-founded"><b>{{ exposition.foundation_year }}</b> год основания</div>
</div> </div>
<!-- {% if st.countries_number or st.countries %}
<div class="ep-countries clearfix"> <div class="ep-countries clearfix">
<div class="epc-title">{% trans 'Страны' %}</div> <div class="epc-title">{% trans 'Страны' %}</div>
<div class="epc-list"> <div class="epc-list">
{% if st.countries_number %}
<ul> <ul>
<li>Австралия</li> <li>{{ st.countries_number }} {% trans 'стран-участниц' %}</li>
<li>Австрия</li>
<li>Азербайджан</li>
<li>Албания</li>
<li>Алжир</li>
<li>Ангола</li>
</ul> </ul>
{% else %}
{% with html=st.countries|generate_countries_list %}
{{ html|safe }}
{% endwith %}
<ul> {% endif %}
<li>Андорра</li>
<li>Антигуа</li>
<li>Аргентина</li>
<li>Армения</li>
<li>Афганистан</li>
<li>Багамские острова</li>
</ul>
<ul>
<li>Бангладеш</li>
<li>Барбадос</li>
<li>Бахрейн</li>
<li>Белиз</li>
</ul>
</div> </div>
</div> </div>
--> {% endif %}
</div> </div>

@ -12,12 +12,12 @@
<form class="pw-form" id="callback-form" action="/callback/"> <form class="pw-form" id="callback-form" action="/callback/">
<div class="pwf-line"> <div class="pwf-line">
<div class="pwf-field"> <div class="pwf-field">
<input type="text" placeholder="Контактное лицо" name="callback_name" id="id_callback_name"> <input type="text" placeholder="Контактное лицо" name="person_inf" id="id_person_inf">
</div> </div>
</div> </div>
<div class="pwf-line"> <div class="pwf-line">
<div class="pwf-field"> <div class="pwf-field">
<input type="text" placeholder="Контактный номер телефона" name="callback_phone" id="id_callback_phone"> <input type="text" placeholder="Контактный номер телефона" name="phone" id="id_phone">
</div> </div>
</div> </div>
<div class="pwf-buttons-line"> <div class="pwf-buttons-line">

@ -13194,6 +13194,7 @@ hr + .rq-note {
.edit-profile .theme-form select{ .edit-profile .theme-form select{
opacity: 0; opacity: 0;
} }
/************************\ /************************\
# about page /about/ # about page /about/
\***********************/ \***********************/

@ -11,7 +11,8 @@ def get_tag(request):
qs = Tag.objects.language().filter(theme__id__in=themes).order_by('translations__name').distinct() qs = Tag.objects.language().filter(theme__id__in=themes).order_by('translations__name').distinct()
else: else:
qs = Tag.objects.language().filter(theme__id__in=themes, translations__name__contains=term).distinct() qs = Tag.objects.language().filter(theme__id__in=themes, translations__name__contains=term).distinct()
result = [{'id': tag.id, 'label': tag.name} for tag in qs] result = [{'id': tag.id, 'label': '%s (%s)'%(tag.name, tag.theme.name)} for tag in qs]
result = sorted(result, key=lambda x:x['label'])
return HttpResponse(json.dumps(result), content_type='application/json') return HttpResponse(json.dumps(result), content_type='application/json')
#else: #else:

Loading…
Cancel
Save