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 django.conf import settings
from exposition.models import Exposition from exposition.models import Exposition
from theme.models import Theme from theme.models import Theme
from theme.models import Theme, Tag
class Command(BaseCommand): class Command(BaseCommand):
@ -20,12 +21,14 @@ class Command(BaseCommand):
cursorclass=DictCursor) cursorclass=DictCursor)
cursor = db.cursor() cursor = db.cursor()
activate('ru') activate('ru')
expos = Exposition.enable.upcoming().filter(logo='') #expos = Exposition.enable.upcoming().filter(logo='')
#expo = Exposition.objects.get(old_url='mir-detstva-i-shkoly-2015') expos = Exposition.objects.filter(tag__isnull=True).order_by('-data_end')
#handle_expo(expo, cursor) #expo = Exposition.objects.get(old_url='salon-du-livre-2015')
#handle_expo_tag(expo, cursor)
for expo in expos: for expo in expos:
handle_expo(expo, cursor) handle_expo_tag(expo, cursor)
@ -61,7 +64,54 @@ class Command(BaseCommand):
print('----------------------') 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): def handle_expo(expo, cursor):
"""
fixing logos
"""
if expo.logo: if expo.logo:
return return

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

@ -58,6 +58,7 @@
<div class="abn"> <div class="abn">
{% block menu_banner %} {% block menu_banner %}
{% comment %}
{% if False|random3 == 1 %} {% if False|random3 == 1 %}
<a target="_blank" href="/redirect/redirect/31/"><img src="{% static 'client/img/partners/expomap-seminars-01.jpg' %}" alt="" /></a> <a target="_blank" href="/redirect/redirect/31/"><img src="{% static 'client/img/partners/expomap-seminars-01.jpg' %}" alt="" /></a>
{% else %} {% else %}
@ -67,6 +68,7 @@
<a target="_blank" href="/redirect/redirect/33/"><img src="{% static 'client/img/partners/expomap-seminars-03.gif' %}" alt="" /></a> <a target="_blank" href="/redirect/redirect/33/"><img src="{% static 'client/img/partners/expomap-seminars-03.gif' %}" alt="" /></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endcomment %}
{% endblock %} {% endblock %}
</div> </div>
</div> </div>

Loading…
Cancel
Save