diff --git a/article/admin.py b/article/admin.py index 94a892a3..ff178cee 100644 --- a/article/admin.py +++ b/article/admin.py @@ -5,6 +5,7 @@ from django.core.context_processors import csrf from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.contenttypes.models import ContentType +from django.views.generic import DeleteView #models and forms from forms import ArticleForm, ArticleDeleteForm, Article, NewsForm from theme.models import Tag @@ -16,6 +17,18 @@ from functions.custom_views import objects_list, add_object_with_file, delete_ob from functions.views_help import get_referer +class ArticleDeleteView(DeleteView): + model = Article + template_name = "admin/article/article_confirm_delete.html" + + def get_success_url(self): + if self.object.type == 1: + type = "blog" + else: + type = "news" + return "/admin/article/%s/all/" % type + + def article_all(request): """ Return list of all articles with pagination diff --git a/article/admin_urls.py b/article/admin_urls.py index cbc9b1f6..ed180fb2 100644 --- a/article/admin_urls.py +++ b/article/admin_urls.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from django.conf.urls import patterns, url -from admin import BlogList, BlogView, NewsList, NewsView +from admin import BlogList, BlogView, NewsList, NewsView, ArticleDeleteView urlpatterns = patterns('article.admin', @@ -11,6 +11,7 @@ urlpatterns = patterns('article.admin', #url(r'^all/$', 'article_all'), url(r'^blog/all/$', BlogList.as_view()), url(r'^blog/$', BlogView.as_view()), + url(r'^delete/(?P.*)/$', ArticleDeleteView.as_view()), url(r'^news/all/$', NewsList.as_view()), url(r'^news/$', NewsView.as_view()), diff --git a/article/forms.py b/article/forms.py index 2648f96b..8810abe7 100644 --- a/article/forms.py +++ b/article/forms.py @@ -19,7 +19,7 @@ from conference.models import Conference class BlogForm(forms.Form): type = Article.blog - theme = forms.ModelMultipleChoiceField(label='Тематики', queryset=Theme.objects.all(), required=False, + theme = forms.ModelMultipleChoiceField(label='Тематики', queryset=Theme.objects.exclude(article__id=None), required=False, widget=forms.SelectMultiple(attrs={'style':'width: 550px'})) publish_date = forms.DateField(label=u'Дата публикации', input_formats=['%Y-%m-%d', '%d.%m.%Y'], required=False) tag = forms.CharField(label=u'Теги', widget=forms.HiddenInput(), required=False) @@ -258,7 +258,7 @@ class BlogForm(forms.ModelForm): class ArticleFilterForm(forms.Form): theme = forms.MultipleChoiceField(label=_(u'Тематика:'), required=False, - choices=[(item.id, item.name) for item in Theme.objects.language().all()]) + choices=[(item.id, item.name) for item in Theme.objects.language().filter(article__type=1).exclude(article__id=None).distinct()]) tag = forms.CharField(label=_(u'Теги:'), widget=forms.HiddenInput(), required=False) ''' @@ -273,6 +273,7 @@ class ArticleFilterForm(forms.Form): choices=[(item.id, item.name) for item in Theme.objects.language().filter(id__in=ids)]) ''' + class BlogFilterForm(forms.Form): tag = forms.CharField(label=_(u'Теги:'), widget=forms.HiddenInput(), required=False) @@ -285,6 +286,7 @@ class BlogFilterForm(forms.Form): self.fields['theme'] = forms.MultipleChoiceField(label=_(u'Тематика:'), required=False, choices=[(item.id, item.name) for item in Theme.objects.language().filter(id__in=ids)]) + class NewsFilterForm(forms.Form): tag = forms.CharField(label=_(u'Теги:'), widget=forms.HiddenInput(), required=False) @@ -295,4 +297,4 @@ class NewsFilterForm(forms.Form): super(NewsFilterForm, self).__init__(*args, **kwargs) ids = [item['theme'] for item in list(Article.objects.news().values('theme').distinct())] self.fields['theme'] = forms.MultipleChoiceField(label=_(u'Тематика:'), required=False, - choices=[(item.id, item.name) for item in Theme.objects.language().filter(id__in=ids)]) \ No newline at end of file + choices=[(item.id, item.name) for item in Theme.objects.language().exclude(article__id=None).filter(id__in=ids)]) \ No newline at end of file diff --git a/article/models.py b/article/models.py index 5b981113..5a0da916 100644 --- a/article/models.py +++ b/article/models.py @@ -81,7 +81,7 @@ class Article(TranslatableModel): old_id = models.IntegerField(blank=True, null=True) logo = ImageField(upload_to='articles_preview', blank=True) theme = models.ManyToManyField('theme.Theme') - tag = models.ManyToManyField('theme.Tag', related_name='tags',blank=True, null=True) + tag = models.ManyToManyField('theme.Tag', blank=True, null=True) author = models.ForeignKey('accounts.User', verbose_name='Автор', on_delete=models.PROTECT, related_name='articles') exposition = models.ForeignKey('exposition.Exposition', blank=True, null=True) diff --git a/article/urls.py b/article/urls.py index a0faf232..482a9e76 100644 --- a/article/urls.py +++ b/article/urls.py @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- from django.conf.urls import patterns, url -from views import BlogList, NewsList, BlogDetail, NewsDetail, NewsTagCatalog, BlogsTagCatalog +from views import BlogList, NewsList, BlogDetail, NewsDetail, NewsTagCatalog, BlogsFilterCatalog urlpatterns = patterns('', - url(r'^blogs/tag/(?P.*)/page/(?P\d+)/$', BlogsTagCatalog.as_view(), {'meta_id':75}), + url(r'^blogs/tag/(?P.*)/page/(?P\d+)/$', BlogsFilterCatalog.as_view(), {'meta_id':75, 'filter':'tag'}), + url(r'^blogs/theme/(?P.*)/page/(?P\d+)/$', BlogsFilterCatalog.as_view(), {'filter':'theme'}), url(r'^blogs/page/(?P\d+)/$', BlogList.as_view(), {'meta_id':79}), - url(r'^blogs/tag/(?P.*)/$', BlogsTagCatalog.as_view(), {'meta_id':75}), + url(r'^blogs/tag/(?P.*)/$', BlogsFilterCatalog.as_view(), {'meta_id':75, 'filter':'tag'}), + url(r'^blogs/theme/(?P.*)/$', BlogsFilterCatalog.as_view(), {'filter':'theme'}), url(r'^blogs/$', BlogList.as_view(), {'meta_id':79}), diff --git a/article/views.py b/article/views.py index 53dbdb6e..7b5c68ec 100644 --- a/article/views.py +++ b/article/views.py @@ -5,11 +5,12 @@ from functions.custom_views import ListView from django.http import HttpResponse from models import Article from forms import ArticleFilterForm -from theme.models import Tag +from theme.models import Tag, Theme from meta.views import MetadataMixin + class NewsList(MetadataMixin, ListView): model = Article template_name = 'article/news_list.html' @@ -53,7 +54,6 @@ class NewsList(MetadataMixin, ListView): return context - class NewsDetail(MetadataMixin, DetailView): model = Article slug_field = 'slug' @@ -163,7 +163,7 @@ class NewsTagCatalog(MetadataMixin, ListView): -class BlogsTagCatalog(MetadataMixin, ListView): +class BlogsFilterCatalog(MetadataMixin, ListView): model = Article template_name = 'client/article/catalog.html' catalog_url = '/blogs/tag/' @@ -171,12 +171,19 @@ class BlogsTagCatalog(MetadataMixin, ListView): year = None month = None - def get_queryset(self): + def get_queryset(self, **kwargs): slug = self.kwargs.get('slug') - tag = get_object_or_404(Tag, url=slug) - self.kwargs['tag'] = tag - self.filter_object = tag - qs = Article.objects.blogs().filter(tag=tag) + filter = self.kwargs['filter'] + if filter == 'tag': + tag = get_object_or_404(Tag, url=slug) + self.kwargs['tag'] = tag + self.filter_object = tag + qs = Article.objects.blogs().filter(tag=tag) + else: + theme = get_object_or_404(Theme, url=slug) + self.kwargs['theme'] = theme + self.filter_object = theme + qs = Article.objects.blogs().filter(theme = theme) year = self.kwargs.get('year') if year: @@ -201,8 +208,9 @@ class BlogsTagCatalog(MetadataMixin, ListView): def get_context_data(self, **kwargs): - context = super(BlogsTagCatalog, self).get_context_data(**kwargs) + context = super(BlogsFilterCatalog, self).get_context_data(**kwargs) context['filter_object'] = self.filter_object + context['type'] = 'article' context['year'] = self.year context['month'] = self.month context['catalog_url'] = self.catalog_url diff --git a/core/utils.py b/core/utils.py index 665a38e8..7dd2b4af 100644 --- a/core/utils.py +++ b/core/utils.py @@ -6,8 +6,23 @@ http://www.simplistix.co.uk/presentations/python-excel.pdf """ import xlwt import datetime -from django.conf import settings from django.core.exceptions import ObjectDoesNotExist +from django.conf import settings +from django.utils.translation import get_language +import os + +current_lang = get_language()[:2] +if current_lang == 'ru': + header_list = [u'#', u'Название события',u'Даты',u'Краткое описание',u'Место проведения', u'Заметка', u'Ссылка на событие'] + main_header = u'Мой календарь собитий на {month} {year} года' +else: + header_list = [u'#', u'Event',u'Period',u'Short description',u'Place', u'Notes', u'Hyperlink'] + main_header = u'My event calendar on {month} {year}' + + + + + HEADER_STYLE = xlwt.easyxf('font: bold on') DEFAULT_STYLE = xlwt.easyxf() @@ -47,6 +62,12 @@ def get_column_cell(obj, name): def queryset_to_workbook(queryset, columns, report_date = None): + # localization + if current_lang == 'ru': + month_name = settings.MONTHES[report_date.strftime("%b").lower()]['name'] + else: + month_name = report_date.strftime("%B") + # defining styles for different types of cells main_style = xlwt.Style.easyxf( "font: name Calibri, height 600, bold False;" @@ -64,13 +85,13 @@ def queryset_to_workbook(queryset, columns, report_date = None): odd_style = xlwt.Style.easyxf( 'font: name Calibri, height 300, bold False;' 'borders: left thin, right thin, top thin, bottom thin;' - 'alignment: horizontal center, wrap True;' + 'alignment: horizontal center, vertical center, wrap True;' 'pattern: pattern solid, fore_color white;', ) even_style = xlwt.Style.easyxf( 'font: name Calibri, height 300, bold False;' 'borders: left thin, right thin, top thin, bottom thin;' - 'alignment: horizontal center, wrap True;' + 'alignment: horizontal center, vertical center, wrap True;' 'pattern: pattern solid, fore_color silver_ega;', ) # creating workbook and adding sheet @@ -80,13 +101,13 @@ def queryset_to_workbook(queryset, columns, report_date = None): sheet = workbook.add_sheet(sheet_name) # drawing head part with image - sheet.write_merge(0, 6, 0, 6, u'Мой календарь собитий на %s года' % report_date.strftime("%B %Y"), main_style) + sheet.write_merge(0, 6, 0, 6, main_header.format( + month = month_name,year = report_date.strftime("%Y")), main_style) for i in range(7): sheet.row(i).set_style(xlwt.Style.easyxf('font:height 300;')) - sheet.insert_bitmap(settings.MEDIA_ROOT + 'logo.bmp', row=0, col=5, x=0, y=0, scale_x=0.3, scale_y=2) + sheet.insert_bitmap(os.path.join(settings.MEDIA_ROOT, 'logo.bmp'), row=0, col=5, x=0, y=0, scale_x=0.3, scale_y=2) # drawing headers - header_list = [u'#', u'Название события',u'Даты',u'Краткое описание',u'Место проведения', u'Заметка', u'Ссылка на событие'] for i, column in enumerate(columns): sheet.write(8, i, header_list[i], header_style) sheet.col(i).width = 8000 diff --git a/core/views.py b/core/views.py index 1ad5be9a..8da905d5 100644 --- a/core/views.py +++ b/core/views.py @@ -282,9 +282,9 @@ def download_workbook(request): setattr(obj, 'dates', u'%s - %s'%(obj.data_begin.strftime('%d %B %Y'),obj.data_end.strftime('%d %B %Y'))) setattr(obj, 'full_place', u'%s, %s, %s' % (obj.country, obj.city, getattr(obj.place, 'name', ''))) try: - setattr(obj, 'link', u'http://www.expomap.ru%s)'%obj.get_absolute_url()) + setattr(obj, 'link', u'http://www.expomap.ru%s'%obj.get_absolute_url()) except: - setattr(obj, 'link', u'http://www.expomap.ru%s)'%obj.get_permanent_url()) + setattr(obj, 'link', u'http://www.expomap.ru%s'%obj.get_permanent_url()) columns = ( 'number', @@ -297,7 +297,7 @@ def download_workbook(request): workbook = queryset_to_workbook(qs, columns, earliest_event) response = HttpResponse(content_type='application/vnd.ms-excel') - response['Content-Disposition'] = 'attachment; filename="My calendar.xls"' + response['Content-Disposition'] = 'attachment; filename="My calendar for %s.xls"' % earliest_event.strftime("%B %Y") workbook.save(response) return response else: diff --git a/expobanner/admin.py b/expobanner/admin.py index 7d1bf1b1..4c053c53 100644 --- a/expobanner/admin.py +++ b/expobanner/admin.py @@ -117,10 +117,10 @@ class BannerStat(DetailView): date_from, date_to = self.request.GET.get('date_from'), self.request.GET.get('date_to') if date_from: date_from = datetime.strptime(date_from, "%d.%m.%Y") - qs = qs.filter(date__gt=date_from) + qs = qs.filter(date__gte=date_from) if date_to: date_to = datetime.strptime(date_to, "%d.%m.%Y") - qs = qs.filter(date__lt=date_to) + qs = qs.filter(date__lte=date_to) context['stats'] = qs return context @@ -195,10 +195,10 @@ class PaidStat(DetailView): date_from, date_to = self.request.GET.get('date_from'), self.request.GET.get('date_to') if date_from: date_from = datetime.strptime(date_from, "%d.%m.%Y") - qs = qs.filter(date__gt=date_from) + qs = qs.filter(date__gte=date_from) if date_to: date_to = datetime.strptime(date_to, "%d.%m.%Y") - qs = qs.filter(date__lt=date_to) + qs = qs.filter(date__lte=date_to) context['stats'] = qs return context @@ -264,10 +264,10 @@ class MainStat(DetailView): date_from, date_to = self.request.GET.get('date_from'), self.request.GET.get('date_to') if date_from: date_from = datetime.strptime(date_from, "%d.%m.%Y") - qs = qs.filter(date__gt=date_from) + qs = qs.filter(date__gte=date_from) if date_to: date_to = datetime.strptime(date_to, "%d.%m.%Y") - qs = qs.filter(date__lt=date_to) + qs = qs.filter(date__lte=date_to) context['stats'] = qs return context diff --git a/functions/custom_views.py b/functions/custom_views.py index 781626cc..01e0ac25 100644 --- a/functions/custom_views.py +++ b/functions/custom_views.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from django.shortcuts import render_to_response -from django.http import HttpResponseRedirect, HttpResponse +from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.core.context_processors import csrf from django.conf import settings from django.contrib.auth.decorators import login_required @@ -20,8 +20,11 @@ import random from django.views.generic import ListView as OldListView + class ListView(OldListView): """ + Default Django generic ListView with few overrided methods for redirecting + onto first page of pagination in case of entering big page number(for search engines) List of modules, where overrided ListView is used: - accounts.views - article.views @@ -34,7 +37,37 @@ class ListView(OldListView): - specialist_catalog.views - translator.views """ - paginator_class = settings.DEFAULT_PAGINATOR + def paginate_queryset(self, queryset, page_size): + """ + Paginate the queryset, if needed. + """ + paginator = self.get_paginator(queryset, page_size, allow_empty_first_page=self.get_allow_empty()) + page_kwarg = self.page_kwarg + page = self.kwargs.get(page_kwarg) or self.request.GET.get(page_kwarg) or 1 + try: + page_number = int(page) + except ValueError: + if page == 'last': + page_number = paginator.num_pages + else: + raise Http404(_("Page is not 'last', nor can it be converted to an int.")) + try: + page = paginator.page(page_number) + self.kwargs['home'] = False + + except EmptyPage as e: + page = paginator.page(1) + self.kwargs['home'] = True + return (paginator, page, page.object_list, page.has_other_pages()) + + def get(self, request, *args, **kwargs): + response = super(ListView, self).get(request, *args, **kwargs) + if self.kwargs.get("home"): + path = self.request.path + return HttpResponseRedirect(path[:path.find('page')]) + else: + return response + @login_required def filtered_list(request, objects, template, item_per_page=settings.ADMIN_PAGINATION): diff --git a/functions/form_check.py b/functions/form_check.py index cfbe998f..19b93f86 100644 --- a/functions/form_check.py +++ b/functions/form_check.py @@ -15,12 +15,9 @@ def is_positive_integer(data, else: raise ValidationError(msg) - -from slugify import slugify - +from django.utils.encoding import smart_str, smart_unicode +import unicodedata def translit_with_separator(string, separator='-'): - - #return slugify(string) """ Trsanslit string and replace "bad" symbols for separator @@ -30,15 +27,13 @@ def translit_with_separator(string, separator='-'): #make string unicode string = string.strip() - string = u'%s'%string + string = smart_unicode(string) #make string translit try: st = pytils.translit.translify(string) except ValueError: - # remove exception symbs(hack) - string = string.replace(u'\u200e', '') - string = string.replace(u'\u200b', '') + string = unicodedata.normalize('NFKD', string).encode('ascii','ignore') st = pytils.translit.translify(string) #replace "bad" symbols for '-'symbol @@ -54,7 +49,6 @@ def translit_with_separator(string, separator='-'): return st.lower() - def is_latin_char(uchr): latin_letters= {} try: return latin_letters[uchr] diff --git a/proj/admin.py b/proj/admin.py index 39bccbc2..7c8afd82 100644 --- a/proj/admin.py +++ b/proj/admin.py @@ -3,7 +3,7 @@ from django.shortcuts import render_to_response from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.contrib.contenttypes.models import ContentType from django.conf import settings -from django.views.generic import TemplateView +from django.views.generic import TemplateView, DeleteView from file.models import TmpFile, FileModel from file.forms import FileModelForm, FileForm from city.models import City @@ -13,6 +13,10 @@ from django.db.models.loading import get_model + + + + class AdminIndex(TemplateView): template_name = 'admin/base.html' diff --git a/settings/templatetags/template_filters.py b/settings/templatetags/template_filters.py index fb26e631..7f1fbb7a 100644 --- a/settings/templatetags/template_filters.py +++ b/settings/templatetags/template_filters.py @@ -141,8 +141,10 @@ def timesince_exp(value, date=None): """ delta = timedelta(days=28) d = date -value - if d>delta: - return True + + if d > delta: + if date.month== value.month: + return True return False @register.filter diff --git a/static/custom_js/main.js b/static/custom_js/main.js index 7f2f0d3b..3fde29bd 100644 --- a/static/custom_js/main.js +++ b/static/custom_js/main.js @@ -88,7 +88,8 @@ function postTimetable(data, textStatus){ function postStat(data, textStatus){ if(data.success){ - location.reload; + + window.location.reload(); } else{ $.each(data.errors, function(field_name, errors){ @@ -424,7 +425,6 @@ $(document).ready(function(){ $('#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({ diff --git a/templates/admin/article/article_confirm_delete.html b/templates/admin/article/article_confirm_delete.html new file mode 100644 index 00000000..ac15985c --- /dev/null +++ b/templates/admin/article/article_confirm_delete.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} +{% block sidebar %}{% endblock %} +{% block body %} +
{% csrf_token %} +
+

Вы точно хотите удалить "{{ object }}" ?

+ + Нет +
+
+{% endblock %} \ No newline at end of file diff --git a/templates/client/accounts/calendar.html b/templates/client/accounts/calendar.html index d8f69f8e..6a1f8502 100644 --- a/templates/client/accounts/calendar.html +++ b/templates/client/accounts/calendar.html @@ -69,7 +69,7 @@ window.location.href = "/profile/calendar/export/?" + query; } else{ - alert('{% trans "Не выбрано ни одного события!" %}') + alert('{% trans "Не выбрано ни одного события!" %}'); } }); diff --git a/templates/client/article/article.html b/templates/client/article/article.html index da51969d..71f5d860 100644 --- a/templates/client/article/article.html +++ b/templates/client/article/article.html @@ -19,7 +19,7 @@ {% include 'client/includes/article/article_logo.html' with obj=object %}

{{ object.main_title }}

- {{ object.publish_date|date:"d E Y" }}{{ object.author.get_full_name }} + {{ object.created|date:"d E Y" }}{% if object.theme.all.exists %}{% include 'includes/article_theme.html' with obj=object %}{% endif %} {% if request.user.is_admin %} {% trans 'изменить' %} {% endif %} @@ -30,18 +30,6 @@
- - - - - - -
{% trans 'Автор' %}:{% include 'includes/show_logo.html' with obj=object.author %} -

{{ object.author.get_full_name }}

- {% if object.author.profile.fb %} - - {% endif %} -
{% if object.tag.all.exists %}
{% include 'includes/article_tags.html' with obj=object %} diff --git a/templates/client/article/blog_list.html b/templates/client/article/blog_list.html index de840d8d..0915cde5 100644 --- a/templates/client/article/blog_list.html +++ b/templates/client/article/blog_list.html @@ -45,11 +45,12 @@ diff --git a/templates/client/article/catalog.html b/templates/client/article/catalog.html index 46a79584..f74c582f 100644 --- a/templates/client/article/catalog.html +++ b/templates/client/article/catalog.html @@ -30,7 +30,15 @@ {% block page_title %}
-

{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Новости' %}: {{ filter_object.name }}{% endif %}

+

{% if meta %} + {{ meta.h1 }} + {% else %} + {% if type == "article" %} + {% trans 'Статьи' %}: + {% else %} + {% trans 'Новости' %}: + {% endif %} + {{ filter_object.name }}{% endif %}

{% ifequal catalog_url '/news/tag/' %} diff --git a/templates/client/base_page.html b/templates/client/base_page.html new file mode 100644 index 00000000..a76f1c26 --- /dev/null +++ b/templates/client/base_page.html @@ -0,0 +1,113 @@ +{% extends 'blank.html' %} + +{% load static %} +{% load i18n %} +{% load template_filters %} + + +{% block main_part %} +
+
+ + +
+ {% with search_form=search_form %} + {% include 'client/includes/catalog_search.html' %} + {% endwith %} + {% block under_search_baner %} + {% include 'client/includes/banners/under_search.html' %} + {% endblock %} + + {% block bread_scrumbs %} + + {% endblock %} + +
+ {% block page_title %} + + {% endblock %} +
+ + {% block page_filter %} + {% endblock %} + + {% block page_body %} +
+ {% block content_list %} + {% endblock %} + + {% block paginator %} + + + {% endblock %} + + {% block content_footer_banner %} + {% endblock %} +
+ + {% block content_text %} + {% comment %} + {% with filter=filter %} + {% include 'includes/event_list_description.html' %} + {% endwith %} + {% endcomment %} + + {% endblock %} + {% endblock %} +
+
+
+{% endblock %} diff --git a/templates/client/exposition/exposition_price.html b/templates/client/exposition/exposition_price.html new file mode 100644 index 00000000..6e341365 --- /dev/null +++ b/templates/client/exposition/exposition_price.html @@ -0,0 +1,219 @@ +{% extends 'base_catalog.html' %} +{% load static %} +{% load i18n %} +{% load template_filters %} + + +{% block content_list %} + +{% block content_text %} +{% block page_body %} +
+
+ + +
+
+
+ {% if object_list.0.main_title %} + {{ object_list.0.main_title|safe }} + {% else %} + {{ object_list.0.name|safe }} + {% endif %} +
+
+ +
+ {% with obj=object_list.0 %} + {% include 'client/includes/show_date_block.html' %} + {% endwith %} +
+ {% if object_list.0.place %} +
+
+
+ {{ object_list.0.place.address.address }} +
+ +
+ + +
+ {% endif %} + + +
+
+
+
{% trans 'Стоимость посещения и участия' %}
+
+ +
+
+ +
+
{% trans 'Для посещения' %}
+ +
{% trans 'Стоимость билетов' %}
+ +
+ +
    + {% if object_list.0.price_day %} +
  • +
    {{ object_list.0.price_day }} €
    +
    {% trans 'на 1 день' %}
    +
  • + {% endif %} + {% if object_list.0.price_all %} +
  • +
    {{ object_list.0.price_all }} €
    +
    {% trans 'на все дни' %}
    +
  • + {% endif %} + +
+ +
{% trans 'Предварительная регистрация' %}
+ +
+ +
+ +
    + {% if object_list.0.price_day_bar %} +
  • +
    {{ object_list.0.price_day_bar }} €
    + +
    на 1 день
    +
  • + {% endif %} + {% if object_list.0.price_all_bar %} +
  • +
    {{ object_list.0.price_all_bar }} €
    +
    {% trans 'на все дни' %}
    +
  • + {% endif %} + +
+ +
{% trans 'Регистрация на' %} {% trans 'стойке' %}
+ +
+ +
+ +
+
{% trans 'Выставка открыта для' %}:
+
    + {{ object_list.0.get_audience }} + +
+
+
+ +
+ +
+
{% trans 'Для участия' %}
+ +
{% trans 'Стоимость аренды 1м²' %}
+ +
    + {% if object_list.0.max_closed_equipped_area %} +
  • + +
    {{ object_list.0.max_closed_equipped_area }} €
    +
    {% trans 'оборудованная площадь' %}
    +
  • + {% endif %} + + {% if object_list.0.max_closed_area %} +
  • +
    {{ object_list.0.max_closed_area }} €
    +
    {% trans 'необорудованная площадь' %}
    +
  • + {% endif %} + + {% if object_list.0.max_open_area %} +
  • +
    {{ object_list.0.max_open_area }} €
    +
    {% trans 'открытая площадь' %}
    +
  • + {% endif %} + +
+ + {% trans 'Заявка на участие' %} + +
+ {% if object_list.0.min_stand_size %} +

{% trans 'Минимальный размер стенда' %} — {{ object_list.0.min_stand_size }}м²

+ {% endif %} + {% if object_list.0.registration_payment %} +

{% trans 'Регистрационный взнос' %} — {{ object_list.0.registration_payment }}€

+ {% endif %} + {% if object_list.0.application_deadline %} +

{% trans 'Крайний срок подачи заявки' %} — {{ object_list.0.application_deadline }}

+ {% endif %} + +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+{% endblock %} +{% endblock %} +{% endblock %} diff --git a/templates/client/includes/article_theme.html b/templates/client/includes/article_theme.html new file mode 100644 index 00000000..b31570bd --- /dev/null +++ b/templates/client/includes/article_theme.html @@ -0,0 +1,6 @@ + +{% with theme=obj.theme.all %} + {% for theme in obj.theme.all %} + {{ theme.name }}{% if forloop.counter != themes|length %},{% endif %} + {% endfor %} +{% endwith %} \ No newline at end of file diff --git a/templates/client/includes/banners/expo_list_baner.html b/templates/client/includes/banners/expo_list_baner.html new file mode 100644 index 00000000..eab61fee --- /dev/null +++ b/templates/client/includes/banners/expo_list_baner.html @@ -0,0 +1,6 @@ +{% load static %} +
+ {% if theme_for_filter.id in banner_themes or tag_for_filter.id in banner_tags %} + + {% endif %} +
\ No newline at end of file diff --git a/templates/client/includes/banners/under_search.html b/templates/client/includes/banners/under_search.html new file mode 100644 index 00000000..8212f939 --- /dev/null +++ b/templates/client/includes/banners/under_search.html @@ -0,0 +1,19 @@ +{% load static %} +{% load template_filters %} + +
+ {% with r=False|random4 %} + {% ifequal r 0 %} + + {% endifequal %} + {% ifequal r 1 %} + + {% endifequal %} + {% ifequal r 2 %} + + {% endifequal %} + {% ifequal r 3 %} + + {% endifequal %} + {% endwith %} +
\ No newline at end of file diff --git a/templates/client/includes/conference/default_description.html b/templates/client/includes/conference/default_description.html index 255c9745..cd2633b1 100644 --- a/templates/client/includes/conference/default_description.html +++ b/templates/client/includes/conference/default_description.html @@ -1,7 +1,7 @@ {% load i18n %} -
+
{% blocktrans with name=conf.name%} -

Конференция {{name}} проходит {% endblocktrans %}{% include 'client/includes/show_date_block.html' with obj=conf %} +

Конференция {{name}} проходит {% endblocktrans %}{% include 'client/includes/show_date_block.html' with obj=conf %} {% blocktrans with city=conf.name country=country.name name=conf.name id=conf.city.id code=request.LANGUAGE_CODE date1=conf.data_begin|date:'j' date2=conf.data_begin|date:'Y' date3=conf.data_begin|date:'n' date4=conf.data_end|date:'j' date5=conf.data_end|date:'Y' date6=conf.data_end|date:'n' %} в городе {{city}}, {{country}}. Посмотреть, как проехать в место проведения конференции, можно на сайте конгрессной площадки. @@ -15,7 +15,7 @@

Если Вам требуется размещение, мы рекомендуем посмотреть отели и цены в период проведения конференции здесь. Не забудьте проверить место и даты конференции на официальном сайте и в календаре организатора. Событие могут перенести, отменить, объединить с проектом схожей тематики. Expomap не несет ответственности за неточности -предоставляемой информации. -Есть вопрос по участию в {{name}} ? Ответим по тел. +7 (499) 999-12-07

+предоставляемой информации.

+Есть вопрос по участию в {{name}} ? Ответим по тел. +7 (499) 999-12-07 {% endblocktrans %}
\ No newline at end of file diff --git a/templates/client/includes/exposition/default_description.html b/templates/client/includes/exposition/default_description.html index f96b760e..7a61c2da 100644 --- a/templates/client/includes/exposition/default_description.html +++ b/templates/client/includes/exposition/default_description.html @@ -1,12 +1,11 @@ {% load i18n %} -
+
{% blocktrans with name=expo.name %} -

Выставка {{ name }} проводится{% endblocktrans %} +

Выставка {{ name }} проводится{% endblocktrans %} {% include 'client/includes/show_date_block.html' with obj=expo %} - {% blocktrans with city=expo.city.name country=expo.country.name %} в городе {{ city }}, {{ country }} - .{% endblocktrans %} + {% blocktrans with city=expo.city.name country=expo.country.name %} в городе {{ city }}, {{ country }}.

{% endblocktrans %} {% blocktrans with name=expo.name id=expo.city.id code=request.LANGUAGE_CODE date1=expo.data_begin|date:'j' date2=expo.data_begin|date:'Y' date3=expo.data_begin|date:'n' date4=expo.data_end|date:'j' date5=expo.data_end|date:'Y' date6=expo.data_end|date:'n' %} - Экспонируемые продукты и разделы выставки Вы можете посмотреть ниже, в блоке +

Экспонируемые продукты и разделы выставки Вы можете посмотреть ниже, в блоке «Дополнительная информация». Полный список участников {{ name }} размещается на официальном сайте выставки и постоянно обновляется. Там же Вы сможете найти экспонентов предыдущего года. Деловая программа {{ name }} обычно публикуется ближе к @@ -28,7 +27,7 @@ {% blocktrans with name=expo.name %} Не забудьте проверить место и даты выставки на официальном сайте и в календаре выставочного комплекса. Событие могут перенести, отменить, объединить с проектом схожей тематики. - Expomap не несет ответственности за неточности предоставляемой информации. - Есть вопрос о посещении или участии в {{ name }}? Ответим по тел. +7 (499) 999-12-07

+ Expomap не несет ответственности за неточности предоставляемой информации.

+ Есть вопрос о посещении или участии в {{ name }}? Ответим по тел. +7 (499) 999-12-07 {% endblocktrans %}
\ No newline at end of file diff --git a/templates/client/includes/exposition/expo_list_paid.html b/templates/client/includes/exposition/expo_list_paid.html new file mode 100644 index 00000000..6d8e954a --- /dev/null +++ b/templates/client/includes/exposition/expo_list_paid.html @@ -0,0 +1,154 @@ +{% load static %} +{% load i18n %} +{% load template_filters %} +{% with objects=object_list %} + {% if objects %} +
    + + {% for obj in objects %} +
  • +
    + + {% if obj.canceled %} +
    + {% else %} + {% if obj.expohit %} +
    + {% endif %} + {% endif %} +
    + {% with obj=obj %} + {% include 'client/includes/show_logo.html' %} + {% endwith %} +
    +
    +
    +
    + {% if obj.quality_label.ufi.is_set %} +
    + +
    + {% endif %} +
    + +
    +
    + {{ obj.main_title|safe }} +
    +
    +
    +
    + {% with obj=obj %} + {% include 'client/includes/show_date_block.html' %} + {% endwith %} +
    + {% if obj.country %} +
    + {{ obj.country }}, {{ obj.city }} + {% if obj.place %} + , {{ obj.place }} + {% endif %} +
    + {% endif %} +
    +
    +
    +
    + {% include 'client/includes/exposition/services.html' with obj=obj %} + {% include 'client/includes/calendar_button.html' with obj=obj%} +
    + {% with note=obj|note_by_user:request.user %} + {% trans 'заметка' %} +
    +
    + +
    +
    + {% endwith %} +
    + {% if request.user.is_admin %} + + {% endif %} +
    +
    +
    + {% include 'client/buttons/booking_button.html' with object=obj %} +
    +
    +
    +
    +
    + {% if obj.visitors %} + {{ obj.visitors }} + {% endif %} + {% if obj.members %} + {{ obj.members }} + {% endif %} +
    +
    + {% include 'client/includes/exposition/tags.html' with obj=obj %} +
    +
    +
  • + + {% if forloop.counter == 8 %} + + + {%endif %} + {% endfor %} + +
+ {% else %} +

+ + {% trans "Выставки по указанным параметрам не найдены. Попробуйте задать менее точный запрос по теме или расширить период времени" %} + +

+ {% endif %} + +{% endwith %} + + + +{% block scripts %} +{% if request.GET.debug == '1' %} + +{% else %} + +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/templates/client/includes/exposition/exposition_object.html b/templates/client/includes/exposition/exposition_object.html index 53552c55..48034fe6 100644 --- a/templates/client/includes/exposition/exposition_object.html +++ b/templates/client/includes/exposition/exposition_object.html @@ -73,7 +73,6 @@
-\1 {% endif %}
diff --git a/templates/client/includes/exposition/price.html b/templates/client/includes/exposition/price.html index f2470f8b..fd040251 100644 --- a/templates/client/includes/exposition/price.html +++ b/templates/client/includes/exposition/price.html @@ -129,7 +129,7 @@
  • {{ exposition.price_day_bar }} {% if exposition.price_day_bar|isdigit %}{{ exposition.get_currency_html }}{% endif %}
    -
    на 1 день
    +
    {% trans 'на 1 день' %}
  • {% endif %} {% if exposition.price_all_bar %} @@ -177,14 +177,14 @@
    {% trans 'Стоимость аренды 1м²' %}
    - {% if exposition.max_closed_equipped_area or exposition.max_closed_area or exposition.max_open_area %} + {% if exposition.max_closed_equipped_area or exposition.max_closed_area or exposition.max_open_area or exposition.min_closed_area %}
      - {% if exposition.max_closed_equipped_area %} + {% if exposition.max_closed_equipped_area or exposition.min_closed_equipped_area %}
    • {% if exposition.min_closed_equipped_area %} - {{ exposition.min_closed_equipped_area }}-{{ exposition.max_closed_equipped_area }} {{ exposition.get_currency_html }} + {{ exposition.min_closed_equipped_area }}{% if exposition.min_closed_equipped_area %}-{{ exposition.max_closed_equipped_area }}{% endif %} {{ exposition.get_currency_html }} {% else %} {{ exposition.max_closed_equipped_area }} {{ exposition.get_currency_html }} {% endif %} @@ -193,11 +193,11 @@
    • {% endif %} - {% if exposition.max_closed_area %} + {% if exposition.max_closed_area or exposition.min_closed_area %}
    • {% if exposition.min_closed_area %} - {{ exposition.min_closed_area }}-{{ exposition.max_closed_area }} {{ exposition.get_currency_html }} + {{ exposition.min_closed_area }}{% if exposition.max_closed_area %}-{{ exposition.max_closed_area }}{% endif %} {{ exposition.get_currency_html }} {% else %} {{ exposition.max_closed_area }} {{ exposition.get_currency_html }} {% endif %} @@ -206,11 +206,11 @@
    • {% endif %} - {% if exposition.max_open_area %} + {% if exposition.max_open_area or exposition.min_open_area %}
    • {% if exposition.min_open_area %} - {{ exposition.min_open_area }}-{{ exposition.max_open_area }} {{ exposition.get_currency_html }} + {{ exposition.min_open_area }}{% if exposition.max_open_area %}-{{ exposition.max_open_area }}{% endif %} {{ exposition.get_currency_html }} {% else %} {{ exposition.max_open_area }} {{ exposition.get_currency_html }} {% endif %} diff --git a/templates/client/includes/header.html b/templates/client/includes/header.html index be5848e3..88b10a58 100644 --- a/templates/client/includes/header.html +++ b/templates/client/includes/header.html @@ -5,7 +5,7 @@
      diff --git a/templates/client/popups/login.html b/templates/client/popups/login.html index 12ff1fbf..000c6c8d 100644 --- a/templates/client/popups/login.html +++ b/templates/client/popups/login.html @@ -36,8 +36,6 @@
      • -
      • -
      • diff --git a/templates/client/popups/register.html b/templates/client/popups/register.html index 6e4e5204..333ca6b5 100644 --- a/templates/client/popups/register.html +++ b/templates/client/popups/register.html @@ -56,8 +56,6 @@
        • -
        • -
        • diff --git a/templates/client/static_client/img/logo_beta.png b/templates/client/static_client/img/logo_beta.png index 51ee5cb8..ac47efaa 100644 Binary files a/templates/client/static_client/img/logo_beta.png and b/templates/client/static_client/img/logo_beta.png differ diff --git a/theme/urls.py b/theme/urls.py index d8305d20..88a81794 100644 --- a/theme/urls.py +++ b/theme/urls.py @@ -3,4 +3,5 @@ from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^get-tag/$', 'theme.views.get_tag'), + url(r'^get-article-tags/$', 'theme.views.get_article_tags'), ) \ No newline at end of file diff --git a/theme/views.py b/theme/views.py index 25ac1c0a..1deadf9b 100644 --- a/theme/views.py +++ b/theme/views.py @@ -5,15 +5,30 @@ from theme.models import Tag def get_tag(request): #if request.is_ajax(): - themes = request.GET.getlist('themes[]') - term = request.GET['term'].capitalize() - if not term: - qs = Tag.objects.language().filter(theme__id__in=themes).order_by('translations__name').distinct() - else: - qs = Tag.objects.language().filter(theme__id__in=themes, translations__name__contains=term).distinct() - result = [{'id': tag.id, 'label': '%s (%s)'%(tag.name, tag.theme.name)} for tag in qs] - result = sorted(result, key=lambda x:x['label']) + themes = request.GET.getlist('themes[]') + term = request.GET['term'].capitalize() + qs = Tag.objects.language().exclude(theme__article__id=None).distinct() + if term: + qs = qs.filter(translations__name__contains=term) + if themes: + qs = qs.filter(theme__id__in=themes).order_by('translations__name') + 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: # return HttpResponse('not ajax') + + +def get_article_tags(request): + themes = request.GET.getlist('themes[]') + term = request.GET['term'].capitalize() + qs = Tag.objects.language().exclude(article=None).filter(article__type=1).distinct() + if themes: + qs = qs.filter(theme__id__in=themes).order_by('translations__name') + if term: + qs = qs.filter(translations__name__contains=term) + 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') \ No newline at end of file