diff --git a/exposition/views.py b/exposition/views.py index f5c8f113..48b55b3b 100644 --- a/exposition/views.py +++ b/exposition/views.py @@ -294,7 +294,7 @@ MONTHES = settings.MONTHES class ExpoCatalog(MetadataMixin, ListView): model = Exposition paginate_by = settings.CLIENT_PAGINATION - template_name = 'exposition/catalog.html' + template_name = 'client/exposition/catalog.html' search_form = ExpositionSearchForm filter_object = None year = None @@ -445,6 +445,12 @@ class ExpoTagCatalog(ExpoCatalog): self.filter_object = tag return qs + def get_context_data(self, **kwargs): + context = super(ExpoTagCatalog, self).get_context_data(**kwargs) + tag = self.kwargs['tag'] + context['theme_for_filter'] = tag.theme + return context + class ExpoVisitors(MetadataMixin, ListView): paginate_by = settings.CLIENT_PAGINATION diff --git a/import_xls/import_forms.py b/import_xls/import_forms.py index 7d390652..8554605c 100644 --- a/import_xls/import_forms.py +++ b/import_xls/import_forms.py @@ -288,13 +288,13 @@ class ImportEventForm(ImportForm): if row[0] != '': # in first column id try: - obj = self.model.objects.language(lang).get(id=int(row[0])) + obj = model.objects.language(lang).get(id=int(row[0])) except ValueError: - obj = self.model() + obj = model() obj.translate(lang) - except self.model.DoesNotExist: - obj = self.model(id= int(row[0])) + except model.DoesNotExist: + obj = model(id= int(row[0])) obj.translate(lang) else: # if id blank - its a new event @@ -359,6 +359,7 @@ class ImportEventForm(ImportForm): except Exception: setattr(obj, 'place_alt', cell) if not obj.url: + a = obj.name obj.url = translit_with_separator(obj.name) obj.is_published = True try: diff --git a/import_xls/utils.py b/import_xls/utils.py index 334f9608..8efe455c 100644 --- a/import_xls/utils.py +++ b/import_xls/utils.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- import urllib2 import time, xlrd +import os +from PIL import Image from django.conf import settings from django.utils import translation from hvad.utils import get_translation_aware_manager @@ -134,6 +136,7 @@ def to_periodic(value): def to_audience(value, model=Exposition): if value: + translation.activate('ru') l = value.split(', ') if l: new_list = [] @@ -190,9 +193,9 @@ def save_logo(obj, path): return None try: - response = urllib2.urlopen(url, timeout=15) + response = urllib2.urlopen(url, timeout=5) except: - return None + return u'Превышено время ожидания' with open(download_to,'wb') as f: try: @@ -202,6 +205,12 @@ def save_logo(obj, path): # can be timeout return u'Превышено время ожидания' + try: + # check if image + im=Image.open(download_to) + except IOError: + os.remove(download_to) + return u'Неправильный формат логотипа' obj.logo = logo_path + alt_name try: obj.save() diff --git a/templates/admin/base.html b/templates/admin/base.html index a6b935ce..55d78941 100644 --- a/templates/admin/base.html +++ b/templates/admin/base.html @@ -31,9 +31,9 @@ {# The fav icon #} -{# datetimepicker #} - - + {# datetimepicker #} + + {% block scripts %} diff --git a/templates/admin/conference/conference_list.html b/templates/admin/conference/conference_list.html index 327f4a31..5bc54f8b 100644 --- a/templates/admin/conference/conference_list.html +++ b/templates/admin/conference/conference_list.html @@ -7,6 +7,17 @@ {% endblock %} +{% block styles %} + +td a{ + float:left; + margin: 0 10px 10px 0 +} + + +{% endblock %} + + {% block body %}
| id | Название | Дата начала | @@ -41,31 +53,29 @@ {% for item in object_list %} | |||
|---|---|---|---|---|---|---|
| {{ item.id }} | {{ item.name }} | {{ item.data_begin }} | - -+ | + + + Изменить + + + на сайте - | - -- - Изменить + + Удалить | -- - Удалить - - |