From fa092225d9697980c295f739d62a237bbaee6cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D0=B7=D0=B0=D1=80=20=D0=9A=D0=BE=D1=82=D1=8E?= =?UTF-8?q?=D0=BA?= Date: Tue, 5 May 2015 16:43:08 +0300 Subject: [PATCH] Task 158 --- proj/settings.py | 2 + service/models.py | 2 +- service/order_forms.py | 52 ++-- .../includes/conference/conference_list.html | 246 +++++++++--------- .../includes/exposition/exposition_list.html | 18 +- .../client/includes/place/place_list.html | 99 ++++--- templates/client/service/tour.html | 20 +- 7 files changed, 220 insertions(+), 219 deletions(-) diff --git a/proj/settings.py b/proj/settings.py index 8656fdeb..5331016b 100644 --- a/proj/settings.py +++ b/proj/settings.py @@ -404,6 +404,8 @@ MONTHES = {'jan': {'value': 1, 'name': _(u'Январь')}, 'feb': {'value': 2, SNG_COUNTRIES = [159, 186, 31, 6, 99, 13, 189, 64] +CLIENT_DATE_FORMAT = ["%d.%m.%Y"] + # cache pages in random seconds. random in this range CACHE_RANGE = [60, 120] diff --git a/service/models.py b/service/models.py index 0e5eaeec..09a8a657 100644 --- a/service/models.py +++ b/service/models.py @@ -107,7 +107,7 @@ class Translation(AbstractOrder): class Visit(AbstractOrder): fr = models.DateField() to = models.DateField() - people = models.IntegerField() + people = models.IntegerField(blank=True, null=True) hotel_additional = models.TextField(blank=True) city_from = models.CharField(max_length=255, blank=True) hotel_stars = models.CharField(max_length=30, blank=True) diff --git a/service/order_forms.py b/service/order_forms.py index 319db724..f1ecaf4c 100644 --- a/service/order_forms.py +++ b/service/order_forms.py @@ -6,6 +6,7 @@ from models import Catalog, Tickets, Remote, Participation, Translation, Visit, from exposition.models import Exposition from conference.models import Conference from seminar.models import Seminar +from django.conf import settings class AbstractOrderForm(forms.ModelForm): @@ -74,7 +75,7 @@ class AbstractOrderForm(forms.ModelForm): if not phone: return - deduct = ('-','(',')','.',' ') + deduct = ('-','(',')','.',' ', '+') for elem in deduct: phone = phone.replace(elem, '') if phone.isdigit(): @@ -132,42 +133,43 @@ from theme.models import Theme class TranslationForm(AbstractOrderForm): languages = forms.CharField(required=False) themes = forms.CharField(required=False) - fr = forms.DateField(widget=forms.DateInput(attrs={'class': 'date dateFrom', 'placeholder': _(u'дд.мм.гггг')}), required=False) - to = forms.DateField(widget=forms.DateInput(attrs={'class': 'date dateTo', 'placeholder': _(u'дд.мм.гггг')}), required=False) + fr = forms.DateField(input_formats=settings.CLIENT_DATE_FORMAT, + widget=forms.DateInput(attrs={'class': 'date dateFrom', 'placeholder': _(u'дд.мм.гггг')})) + to = forms.DateField(input_formats=settings.CLIENT_DATE_FORMAT, + widget=forms.DateInput(attrs={'class': 'date dateTo', 'placeholder': _(u'дд.мм.гггг')})) class Meta: model = Translation -HOTEL_ADDITIONAL_CHOICES = [('', _(u'Выберите')),(_(u'Условие1'), _(u'Условие1')), - (_(u'Условие2'), _(u'Условие2')),(_(u'Условие3'), _(u'Условие3'))] +HOTEL_ADDITIONAL_CHOICES = [('', _(u'Выберите')), (_(u'Одноместное'), _(u'Одноместное')), + (_(u'Двухместное'), _(u'Двухместное')),(_(u'Трехместное'), _(u'Трехместное'))] AVIA_TYPE_CHOICES = [(_(u'Прямой'), _(u'Прямой')), (_(u'С пересадкой'), _(u'С пересадкой')), (_(u'Бизнес-класс'), _(u'Бизнес-класс')), (_(u'Эконом-класс'), _(u'Эконом-класс'))] -HOTEL_LOCATION_CHOICES = [('', _(u'Выберите')), (_(u'Расположение1'), _(u'Расположение1')), - (_(u'Расположение2'), _(u'Расположение2'))] +HOTEL_LOCATION_CHOICES = [('', _(u'Выберите')), (_(u'Любое'), _(u'Любое')), + (_(u'Рядом с выставкой'), _(u'Рядом с выставкой')), + (_(u'В центре'), _(u'В центре'))] -HOTEL_BUDGET_ADD = [('', _(u'Выберите')), (_(u'В сутки'), _(u'В сутки')), (_(u'В неделю'), _(u'В неделю'))] +HOTEL_BUDGET_ADD = [(_(u'В сутки'), _(u'В сутки')), (_(u'За весь период'), _(u'За весь период'))] class VisitForm(AbstractOrderForm): - fr = forms.DateField(widget=forms.DateInput(attrs={'class': 'date dateFrom', 'placeholder': _(u'дд.мм.гггг')})) - to = forms.DateField(widget=forms.DateInput(attrs={'class': 'date dateTo', 'placeholder': _(u'дд.мм.гггг')})) + fr = forms.DateField(input_formats=settings.CLIENT_DATE_FORMAT, required=False, + widget=forms.DateInput(attrs={'class': 'date dateFrom', 'placeholder': _(u'дд.мм.гггг')})) + to = forms.DateField(input_formats=settings.CLIENT_DATE_FORMAT, required=False, + widget=forms.DateInput(attrs={'class': 'date dateTo', 'placeholder': _(u'дд.мм.гггг')})) hotel_additional = forms.ChoiceField(choices=HOTEL_ADDITIONAL_CHOICES, required=False) - hotel_stars = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(), + hotel_stars = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(), required=False, choices=[('1','1'),('2','2'),('3','3'),('4','4'),('5','5')]) hotel_location = forms.ChoiceField(choices=HOTEL_LOCATION_CHOICES, required=False) hotel_budget_add = forms.ChoiceField(choices=HOTEL_BUDGET_ADD, required=False) - languages = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(), - choices=LANGS) - themes = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(), - choices=[(theme.name, theme.name) for theme in Theme.objects.all()]) - - + languages = forms.CharField(required=False, widget=forms.TextInput(attrs={'placeholder': _(u'Знание языков')})) + themes = forms.CharField(required=False, widget=forms.TextInput(attrs={'placeholder': _(u'Тематика')})) avia_type = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(), - choices=AVIA_TYPE_CHOICES) + choices=AVIA_TYPE_CHOICES, required=False) class Meta: model = Visit @@ -178,20 +180,6 @@ class VisitForm(AbstractOrderForm): else: return ', '.join(hotel_stars) - def clean_languages(self): - languages = self.cleaned_data.get('languages') - if not languages: - return '' - else: - return ', '.join(languages) - - def clean_themes(self): - themes = self.cleaned_data.get('themes') - if not themes: - return '' - else: - return ', '.join(themes) - def clean_avia_type(self): avia_type = self.cleaned_data.get('avia_type') if not avia_type: diff --git a/templates/client/includes/conference/conference_list.html b/templates/client/includes/conference/conference_list.html index 6ecc720f..8b69ed42 100644 --- a/templates/client/includes/conference/conference_list.html +++ b/templates/client/includes/conference/conference_list.html @@ -1,124 +1,134 @@ {% load static %} {% load i18n %} {% load template_filters %} - +{% with objects=object_list %} +{% if objects %} + + {% else %} +

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

+ {% endif %} +{% endwith %} {% block scripts %} {% if request.GET.debug == '1' %} diff --git a/templates/client/includes/exposition/exposition_list.html b/templates/client/includes/exposition/exposition_list.html index b0cbcd8f..92e7eede 100644 --- a/templates/client/includes/exposition/exposition_list.html +++ b/templates/client/includes/exposition/exposition_list.html @@ -1,8 +1,10 @@ {% load static %} {% load i18n %} {% load template_filters %} +{% with objects=object_list %} + {% if objects %} + {% else %} +

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

+ {% endif %} + +{% endwith %} + + + {% block scripts %} {% if request.GET.debug == '1' %} diff --git a/templates/client/includes/place/place_list.html b/templates/client/includes/place/place_list.html index 34b5ac62..d5aae814 100644 --- a/templates/client/includes/place/place_list.html +++ b/templates/client/includes/place/place_list.html @@ -1,56 +1,53 @@ {% load static %} {% load i18n %} - - +{% endwith %} \ No newline at end of file diff --git a/templates/client/service/tour.html b/templates/client/service/tour.html index 998a98fb..a202cb87 100644 --- a/templates/client/service/tour.html +++ b/templates/client/service/tour.html @@ -23,6 +23,7 @@ {% block page_title %}

{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Посещение выставки' %} {% if object %}{{ object.name }}{% endif %}{% endif %}

+ {{ form.errors }}
{% endblock %} @@ -150,28 +151,17 @@
- - + {{ form.languages }}
- -
-
-
-
-
-
    - -
-
-
-
- +
+ {{ form.themes }}
+