remove banners

remotes/origin/1203
Kotiuk Nazarii 11 years ago
parent 9b5674fe8b
commit 03f7d54e1c
  1. 58
      exposition/management/commands/test.py
  2. 2
      templates/client/includes/banners/under_search.html
  3. 2
      templates/client/index.html

@ -7,6 +7,7 @@ from django.core.management.base import BaseCommand
from django.conf import settings
from exposition.models import Exposition
from theme.models import Theme
from theme.models import Theme, Tag
class Command(BaseCommand):
@ -20,12 +21,14 @@ class Command(BaseCommand):
cursorclass=DictCursor)
cursor = db.cursor()
activate('ru')
expos = Exposition.enable.upcoming().filter(logo='')
#expo = Exposition.objects.get(old_url='mir-detstva-i-shkoly-2015')
#handle_expo(expo, cursor)
#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(expo, cursor)
handle_expo_tag(expo, cursor)
@ -61,7 +64,54 @@ class Command(BaseCommand):
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

@ -2,6 +2,7 @@
{% 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 %}
@ -11,6 +12,7 @@
<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 %}

@ -58,6 +58,7 @@
<div class="abn">
{% block menu_banner %}
{% 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 %}
@ -67,6 +68,7 @@
<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>

Loading…
Cancel
Save