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

remotes/origin/1203
Kotiuk Nazarii 11 years ago
commit 50beeb8ded
  1. 14
      core/simple_views.py
  2. 5
      country/models.py
  3. 137
      exposition/management/commands/test.py
  4. 4
      proj/urls.py
  5. 4
      proj/views.py
  6. 9
      settings/templatetags/template_filters.py
  7. 15
      templates/client/includes/banners/under_search.html
  8. 16
      templates/client/includes/conference/conference_object.html
  9. 9
      templates/client/includes/exposition/exposition_object.html
  10. 14
      templates/client/index.html
  11. 6
      templates/client/simple_pages/expo_seminar.html
  12. 6
      templates/client/simple_pages/yandex_check.html
  13. BIN
      templates/client/static_client/img/partners/expomap-seminars-01.jpg
  14. BIN
      templates/client/static_client/img/partners/expomap-seminars-02.gif
  15. BIN
      templates/client/static_client/img/partners/expomap-seminars-03.gif

@ -13,26 +13,32 @@ class SeminarLendingView(TemplateView):
def send_to_organiser(request):
mail_send = 'kotzilla@ukr.net'
mail_send = 'expomap@mail.ru'
fname = request.POST.get('name')
lname = request.POST.get('surname')
email = request.POST.get('email', '')
company = request.POST.get('company', '')
office = request.POST.get('office', '')
phone = request.POST.get('phone', '')
title = request.POST.get('type', '')
text = u"""Имя: %s;
Фамилия:%s;
Email: %s;
Телефон: %s;
компния:%s;
должность: %s"""%(fname, lname, email, company, office)
должность: %s"""%(fname, lname, email, phone, company, office)
msg = EmailMessage(title, text, settings.DEFAULT_FROM_EMAIL, [mail_send])
msg.content_subtype = "html"
msg.send()
redirect_to = '/service/thanks/'
message = u"""Мы получили Ваш запрос и очень рады, что Вам интересно участие в семинаре Expomap. Если места еще есть, мы пришлем Вам приглашение на указанную Вами электронную почту.
Увидимся на welcome-coffee """
if title.endswith(u'семинар'):
message = u"""Мы получили Ваш запрос и очень рады, что Вам интересно участие в семинаре Expomap. Если места еще есть, мы пришлем Вам приглашение на указанную Вами электронную почту.
Увидимся на welcome-coffee """
else:
message = u"""Благодарим за интерес к нашему семинару! За несколько дней до мероприятия мы пришлем Вам ссылку для подключения к онлайн-трансляции!"""
return HttpResponse(json.dumps({'success':True, 'redirect_to': redirect_to, 'message': message}), content_type='application/json')

@ -146,8 +146,9 @@ class Country(TranslatableModel):
return Webinar.objects.filter(country=self.id).count()
def active_cities(self):
return City.used.active_qs().filter(country=self)
result = list(set(City.used.active_qs().filter(country=self)))
result.sort(key=lambda x:x.name)
return result
lang = translation.get_language()
#return City.objects.select_related('exposition_city')\
# .filter(exposition_city__city__isnull=False, translations__language_code=lang, country=self).distinct().order_by('translations__name')

@ -1,20 +1,141 @@
# -*- coding: utf-8 -*-
import MySQLdb
import os.path
from MySQLdb.cursors import DictCursor
from django.utils.translation import activate
from django.core.management.base import BaseCommand
from meta.models import MetaSetting
from django.conf import settings
from exposition.models import Exposition
from theme.models import Theme
from theme.models import Theme, Tag
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()
#expos = Exposition.objects.filter(theme__isnull=True, old_url__isnull=False)
db = MySQLdb.connect(host="localhost",
user="expomap",
passwd="7FbLtAGjse",
db="old_db",
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
activate('ru')
#expos = Exposition.enable.upcoming().filter(logo='')
expos = Exposition.objects.filter(tag__isnull=True).order_by('-data_end')
#expo = Exposition.objects.get(old_url='salon-du-livre-2015')
#handle_expo_tag(expo, cursor)
for expo in expos:
handle_expo_tag(expo, cursor)
'''
find_old_id = """
SELECT products.products_id
from products
LEFT JOIN `products_description` ON products.products_id=products_description.products_id
WHERE url='%s'
"""
find_themes = "SELECT categories_id FROM `products_to_categories` WHERE `products_id` =%d"
'''
"""
for expo in expos:
cursor.execute(find_old_id%expo.old_url)
old_ids = [item['products_id'] for item in cursor.fetchall()]
print expo.old_url
for id in old_ids:
cursor.execute(find_themes%id)
themes_ids = [item['categories_id'] for item in cursor.fetchall()]
print themes_ids
#if not themes_ids:
# continue
theme_qs = Theme.objects.filter(id__in=themes_ids)
#expo.theme.add(*theme_qs)
break
print('----------------------')
"""
def handle_expo_tag(expo, cursor):
old_url = expo.old_url
if not old_url:
return None
print(old_url)
find_old = """
SELECT products.products_id, url
from products
LEFT JOIN `products_description` ON products.products_id=products_description.products_id
WHERE url='%s'
"""
cursor.execute(find_old%old_url)
result = cursor.fetchone()
expo_id = result.get('products_id')
if not expo_id:
return
find_tag_id = """
SELECT tag_id
FROM `products_tags`
WHERE `product_id` =%d
"""
cursor.execute(find_tag_id%expo_id)
tags_ids = [str(item['tag_id']) for item in cursor.fetchall()]
if not tags_ids:
return None
find_tag = """
SELECT title
FROM `tags`
WHERE id in(%s)
"""
cursor.execute(find_tag%', '.join(tags_ids))
tag_names = [item['title'] for item in cursor.fetchall()]
if not tag_names:
return None
themes = [item['id'] for item in expo.theme.all().values('id')]
qs = Tag.objects.filter(translations__name__in=tag_names, theme__in=themes)
expo.tag.add(*qs)
def handle_expo(expo, cursor):
"""
fixing logos
"""
if expo.logo:
return
find_old = """
SELECT products.products_id, url, products_img1 as logo
from products
LEFT JOIN `products_description` ON products.products_id=products_description.products_id
WHERE url='%s'
"""
cursor.execute(find_old%expo.old_url)
result = cursor.fetchall()
if not result:
return
logo = result[0]['logo']
if logo:
logo = logo.replace('..', '')
print(logo)
print(os.path.isfile(settings.MEDIA_ROOT[:-1]+logo))
if (os.path.isfile(settings.MEDIA_ROOT[:-1]+logo)):
expo.logo = logo
expo.save()

@ -11,6 +11,9 @@ class Robot(TemplateView):
template_name = 'robots.txt'
content_type = 'text/plain'
class YandexCheck(TemplateView):
template_name = 'client/simple_pages/yandex_check.html'
from sitemaps import ExpoCard, ExpoCity, ExpoCountry, ExpoTheme, ExpoTag, ConfCard, ConfCity, ConfCountry, ConfTheme,\
ConfTag, NewsSiteMap, BlogsSiteMap, Additional, Important
@ -34,6 +37,7 @@ urlpatterns = patterns('',
url(r'^sitemap\.xml$', views.index, {'sitemaps': sitemaps}),
url(r'^sitemap-(?P<section>.+)\.xml$', views.sitemap, {'sitemaps': sitemaps}),
url(r'^robots.txt$', Robot.as_view()),
url(r'^yandex_4c326c16c916403e.html$', YandexCheck.as_view()),
url(r'^$', MainPageView.as_view()),
url(r'^page/', include('core.simple_urls')),
url(r'^theme/', include('theme.urls')),

@ -37,7 +37,9 @@ def error404(request):
expo_themes = Theme.active.expo_themes_with_count()
conf_themes = Theme.active.conference_themes_with_count()
context.update({'expo_themes': expo_themes, 'conf_themes': conf_themes})
return render_to_response('client/404.html', context, context_instance=RequestContext(request))
response = render_to_response('client/404.html', context, context_instance=RequestContext(request))
response.status_code = 404
return response
class MainPageView(JitterCacheMixin,TemplateView):
cache_range = settings.CACHE_RANGE

@ -156,6 +156,10 @@ def timetable_by_day(qs, day):
def random_social(value):
return bool(random.getrandbits(1))
@register.filter
def random3(value):
return random.randrange(0,3)
@register.filter
def fourth(value):
# return almost in 75% cases True in 25% False
@ -224,7 +228,10 @@ def without_page(value):
@register.filter
def note_by_user(obj, user):
return obj.get_note_by_user(user.id)
if obj:
return obj.get_note_by_user(user.id)
return ''
@register.filter
def isdigit(value):

@ -1,9 +1,24 @@
{% load static %}
{% load template_filters %}
<div class="abn">
{% comment %}
{% if False|random3 == 1 %}
<a target="_blank" href="/redirect/redirect/31/"><img src="{% static 'client/img/partners/expomap-seminars-01.jpg' %}" alt="" /></a>
{% else %}
{% if False|random3 == 2 %}
<a target="_blank" href="/redirect/redirect/32/"><img src="{% static 'client/img/partners/expomap-seminars-02.gif' %}" alt="" /></a>
{% else %}
<a target="_blank" href="/redirect/redirect/33/"><img src="{% static 'client/img/partners/expomap-seminars-03.gif' %}" alt="" /></a>
{% endif %}
{% endif %}
{% endcomment %}
{% comment %}
{% if False|fourth %}
<a target="_blank" href="/redirect/redirect/21/"><img src="{% static 'client/img/partners/unnamed.gif' %}" alt="" /></a>
{% else %}
<a target="_blank" href="/redirect/redirect/23/"><img src="{% static 'client/img/partners/unnamed_1.gif' %}" alt="" /></a>
{% endif %}
{% endcomment %}
</div>

@ -152,6 +152,22 @@
{% endfor %}
{% endwith %}
</dd>
{% else %}
{% if event.org %}
<dt>{% trans 'Организатор' %}:</dt>
<dd>
{{ event.org }}
</dd>
{% endif %}
{% endif %}
{% if event.place_alt %}
{% if not event.place %}
<dt>{% trans 'Место проведения' %}:</dt>
<dd>
{{ event.place_alt }}
</dd>
{% endif %}
{% endif %}
{% if event.web_page %}
<dt>{% trans 'Веб-сайт' %}:</dt>

@ -165,6 +165,15 @@
</dd>
{% endif %}
{% endif %}
{% if exposition.place_alt %}
{% if not exposition.place %}
<dt>{% trans 'Место проведения' %}:</dt>
<dd>
{{ exposition.place_alt }}
</dd>
{% endif %}
{% endif %}
{% if exposition.web_page %}
<dt>{% trans 'Веб-сайт' %}:</dt>
<dd>

@ -58,11 +58,17 @@
<div class="abn">
{% block menu_banner %}
{% if False|fourth %}
<a target="_blank" href="/redirect/redirect/21/"><img src="{% static 'client/img/partners/unnamed.gif' %}" alt="" /></a>
{% comment %}
{% if False|random3 == 1 %}
<a target="_blank" href="/redirect/redirect/31/"><img src="{% static 'client/img/partners/expomap-seminars-01.jpg' %}" alt="" /></a>
{% else %}
<a target="_blank" href="/redirect/redirect/23/"><img src="{% static 'client/img/partners/unnamed_1.gif' %}" alt="" /></a>
{% if False|random3 == 2 %}
<a target="_blank" href="/redirect/redirect/32/"><img src="{% static 'client/img/partners/expomap-seminars-02.gif' %}" alt="" /></a>
{% else %}
<a target="_blank" href="/redirect/redirect/33/"><img src="{% static 'client/img/partners/expomap-seminars-03.gif' %}" alt="" /></a>
{% endif %}
{% endif %}
{% endcomment %}
{% endblock %}
</div>
</div>
@ -88,7 +94,7 @@
</header>
<div id="mp-photo-gallery" class="photo-gallery swiper-container">
<iframe width="100%" height="363" src="https://www.youtube.com/embed/O_JU21xVlsQ" frameborder="0" allowfullscreen></iframe>
<iframe width="100%" height="363" src="https://www.youtube.com/embed/4DUrpYvh3V4" frameborder="0" allowfullscreen></iframe>
</div>
{% comment %}
<div id="mp-photo-gallery" class="photo-gallery swiper-container">

@ -248,6 +248,9 @@
<div class="form-group required">
<input type="text" class="form-control" id="surname" name="surname" placeholder="Фамилия:">
</div>
<div class="form-group required">
<input type="text" class="form-control" id="phone" name="phone" placeholder="Номер телефона:">
</div>
<div class="form-group required">
<input type="text" class="form-control" id="email" name="email" placeholder="Email:">
</div>
@ -286,6 +289,9 @@
<div class="form-group required">
<input type="text" class="form-control" id="surname" name="surname" placeholder="Фамилия:">
</div>
<div class="form-group required">
<input type="text" class="form-control" id="phone" name="phone" placeholder="Номер телефона:">
</div>
<div class="form-group required">
<input type="text" class="form-control" id="email" name="email" placeholder="Email:">
</div>

@ -0,0 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>Verification: 4c326c16c916403e</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Loading…
Cancel
Save