From 92fc959252aca19949e8ca154b34aee6dce383c5 Mon Sep 17 00:00:00 2001 From: Slava Kyrachevsky Date: Mon, 23 Jan 2017 12:34:02 +0200 Subject: [PATCH 1/5] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=D1=8B=20=D1=81=20?= =?UTF-8?q?=D0=BC=D0=B0=D1=81=D1=82=D0=B5=D1=80=20=D0=B2=D0=B5=D1=82=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/conference/forms.py | 3 ++- proj/settings.py | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/conference/forms.py b/apps/conference/forms.py index c636ab93..3cdb0d39 100644 --- a/apps/conference/forms.py +++ b/apps/conference/forms.py @@ -181,7 +181,8 @@ class ConferenceCreateForm(forms.Form): # conference.quality_label = flag - conference.audience = data['audience'] + if data.get('audience'): + conference.audience = data['audience'] if data.get('country'): conference.country = Country.objects.get(id=data['country'])#.id cause select uses queryset diff --git a/proj/settings.py b/proj/settings.py index 79a6b8a3..8a9f363a 100644 --- a/proj/settings.py +++ b/proj/settings.py @@ -400,7 +400,7 @@ INSTALLED_APPS = ( 'south', 'rosetta', 'widget_tweaks', - 'raven.contrib.django.raven_compat', + # 'raven.contrib.django.raven_compat', ) CRONJOBS = [ @@ -531,9 +531,9 @@ PERIODIC = { } # sentry -RAVEN_CONFIG = { - 'dsn': 'http://eb7e4b632b3543f487386cbe9151b174:0b148a7ed13643c88d3a6b014c3a4f65@sentry.oldmin.org/2', -} +# RAVEN_CONFIG = { +# 'dsn': 'http://eb7e4b632b3543f487386cbe9151b174:0b148a7ed13643c88d3a6b014c3a4f65@sentry.oldmin.org/2', +# } try: from local import * From 4706d1eeb4a3ce187506c6b232c36919e0febdcd Mon Sep 17 00:00:00 2001 From: Slava Kyrachevsky Date: Mon, 23 Jan 2017 13:06:07 +0200 Subject: [PATCH 2/5] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B1?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/expobanner/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/expobanner/models.py b/apps/expobanner/models.py index 2bd4c45d..a2a3b9e9 100644 --- a/apps/expobanner/models.py +++ b/apps/expobanner/models.py @@ -165,7 +165,7 @@ class Banner(models.Model, StatMixin): 'group': self.group, 'ip': request.META.get('REMOTE_ADDR'), 'user_agent': request.META.get('HTTP_USER_AGENT'), - 'page': request.META.get('HTTP_REFERER', '')[:255], + 'page': request.META.get('HTTP_REFERER', '')[:200], } if request.user.is_authenticated(): @@ -218,6 +218,7 @@ class Log(models.Model): datetime = models.DateTimeField(verbose_name=_('Clicked At'), auto_now_add=True) ip = models.IPAddressField(verbose_name=_('IP'), null=True, blank=True) user_agent = models.CharField(verbose_name=_('User Agent'), max_length=1024, null=True, blank=True) + # FIXME: в бд реально 250 символов page = models.URLField(verbose_name=_('Page'), null=True, blank=True, max_length=255) key = models.CharField(verbose_name=_('User Agent'), max_length=32, null=True, blank=True) TYPE_CHOICES = ( From 9b7037c34d11f7be43456faa8c55553d941a589b Mon Sep 17 00:00:00 2001 From: Slava Kyrachevsky Date: Mon, 23 Jan 2017 13:58:08 +0200 Subject: [PATCH 3/5] =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?wizard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wizard/__init__.py | 0 apps/wizard/description.txt | 2 - apps/wizard/forms.py | 76 ------- apps/wizard/models.py | 0 apps/wizard/tests.py | 16 -- apps/wizard/urls.py | 7 - apps/wizard/views.py | 131 ------------ requirements.txt | 1 - templates/client/wizard/first_step.html | 209 ------------------ templates/client/wizard/second_step.html | 259 ----------------------- templates/client/wizard/third_step.html | 147 ------------- templates/client/wizard/wizard.html | 25 --- 12 files changed, 873 deletions(-) delete mode 100644 apps/wizard/__init__.py delete mode 100644 apps/wizard/description.txt delete mode 100644 apps/wizard/forms.py delete mode 100644 apps/wizard/models.py delete mode 100644 apps/wizard/tests.py delete mode 100644 apps/wizard/urls.py delete mode 100644 apps/wizard/views.py delete mode 100644 templates/client/wizard/first_step.html delete mode 100644 templates/client/wizard/second_step.html delete mode 100644 templates/client/wizard/third_step.html delete mode 100644 templates/client/wizard/wizard.html diff --git a/apps/wizard/__init__.py b/apps/wizard/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/apps/wizard/description.txt b/apps/wizard/description.txt deleted file mode 100644 index 9da7860c..00000000 --- a/apps/wizard/description.txt +++ /dev/null @@ -1,2 +0,0 @@ -Должен был быть модуль для добавления событий и других даных через кабинет пользователя. -Остановленна разработка по ненадобности, так как делается функционал добавление событий через црм \ No newline at end of file diff --git a/apps/wizard/forms.py b/apps/wizard/forms.py deleted file mode 100644 index 374f9dcb..00000000 --- a/apps/wizard/forms.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- -from django import forms -from theme.models import Theme -from place_exposition.models import PlaceExposition -from country.models import Country -from multiupload.fields import MultiFileField, MultiFileInput -from django.utils.translation import ugettext as _ - - -choices = ((0, ''), (1.0, _(u'Ежегодно')), (2.0, _(u'2 раза в год')), (3.0, _(u'3 раза в год')), (4.0, _(u'4 раза в год')), - (5.0, _(u'5 раз в год')), (0.5, _(u'Раз в 2 года')), ( - 0.33, _(u'Раз в 3 года')), (0.25, _(u'Раз в 4 года'))) - -places = [(item.id, item.name) for item in PlaceExposition.objects.language().all()] -places.insert(0,('', _(u'Не выбрано'))) - - -class ExpoForm1(forms.Form): - """ - main information about exposition - """ - name = forms.CharField(max_length=255, widget=forms.TextInput(attrs={'placeholder': _(u"Введите название выставки")})) - main_title = forms.CharField(max_length=255, widget=forms.TextInput(attrs={'placeholder': _(u"Краткое описание выставки (необязательно)")})) - description = forms.CharField(widget=forms.Textarea(attrs={'placeholder': _(u"Полное описание выставки"), 'cols':30, 'rows':10})) - date_start = forms.DateField(widget=forms.TextInput(attrs={'class':'data dateFrom', 'placeholder':_(u'дд.мм.гг')})) - date_end = forms.DateField(widget=forms.TextInput(attrs={'class':'data dateTo','placeholder':_(u'дд.мм.гг')})) - - country = forms.ChoiceField(label=_(u'Страна'), choices=[(c.id, c.name) for c in Country.objects.all()], widget=forms.Select(attrs={'id':'id_country'})) - theme = forms.MultipleChoiceField(label=_('Тематики'), choices=[(item.id, item.name) for item in Theme.objects.language().all()], widget=forms.SelectMultiple(attrs={'id':'id_theme'})) - place = forms.ChoiceField(label=_(u'Место проведения'), required=False, choices=places, widget=forms.Select(attrs={'id':'id_place'})) - city = forms.CharField(label=_(u'Город'), widget=forms.HiddenInput(attrs={'id':'id_city'})) - tag = forms.CharField(label=_(u'Теги'), widget=forms.HiddenInput(attrs={'id':'id_tag'}), required=False) - - audience1 = forms.BooleanField(required=False) - audience2 = forms.BooleanField(required=False) - audience3 = forms.BooleanField(required=False) - periodic = forms.ChoiceField(choices=choices, required=False) - membership1 = forms.BooleanField(required=False) - membership2 = forms.BooleanField(required=False) - membership3 = forms.BooleanField(required=False) - web_site = forms.URLField(required=False, widget=forms.TextInput(attrs={'placeholder': _(u"Веб-сайт (необязательно)")})) - products = forms.CharField(widget=forms.Textarea(attrs={'placeholder': _(u"Экспонируемые продукты"), 'cols':30, 'rows':10})) - time_start = forms.TimeField() - time_end = forms.TimeField() - logo = forms.ImageField(widget=forms.FileInput(attrs={'class':"button big icon-clip"}), required=False) - - -class ExpoForm2(forms.Form): - """ - statistics - """ - found_year = forms.IntegerField() - # ticket price - pre_one_day = forms.FloatField(widget=forms.TextInput(attrs={'placeholder':_(u'на один день')})) - pre_all_days = forms.FloatField(widget=forms.TextInput(attrs={'placeholder':_(u'на все дни')})) - one_day = forms.FloatField(widget=forms.TextInput(attrs={'placeholder':_(u'на один день')})) - all_days = forms.FloatField(widget=forms.TextInput(attrs={'placeholder':_(u'на все дни')})) - - # rent price - equiped = forms.FloatField(widget=forms.TextInput(attrs={'placeholder':_(u'оборудованная площадь')})) - unequiped = forms.FloatField(widget=forms.TextInput(attrs={'placeholder':_(u'необорудованная площадь')})) - open_square = forms.FloatField(widget=forms.TextInput(attrs={'placeholder':_(u'открытая площадь')})) - min_square = forms.FloatField() - registration_depos = forms.FloatField() - deadline_date = forms.DateField(widget=forms.TextInput(attrs={'placeholder':_(u'дд.мм.гг')})) - - -class ExpoForm3(forms.Form): - """ - photos from last expositions - """ - attachments = MultiFileField(min_num=0, max_num=6, max_file_size=1024*1024*5, widget=MultiFileInput( - attrs={'class':'button big icon-camera', 'value': _(u'выберите фотографии'), 'id': 'files'} - )) - - diff --git a/apps/wizard/models.py b/apps/wizard/models.py deleted file mode 100644 index e69de29b..00000000 diff --git a/apps/wizard/tests.py b/apps/wizard/tests.py deleted file mode 100644 index 501deb77..00000000 --- a/apps/wizard/tests.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.test import TestCase - - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.assertEqual(1 + 1, 2) diff --git a/apps/wizard/urls.py b/apps/wizard/urls.py deleted file mode 100644 index 527cd96d..00000000 --- a/apps/wizard/urls.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.conf.urls import patterns, url -from .views import ExpoWizard -from .forms import ExpoForm1, ExpoForm2,ExpoForm3 - -formlist = [ExpoForm1,ExpoForm2, ExpoForm3] - -urlpatterns = patterns('', url(r'^$', ExpoWizard.as_view(formlist), name = 'add_exposition')) \ No newline at end of file diff --git a/apps/wizard/views.py b/apps/wizard/views.py deleted file mode 100644 index 01dadcac..00000000 --- a/apps/wizard/views.py +++ /dev/null @@ -1,131 +0,0 @@ -from django.contrib.formtools.wizard.views import SessionWizardView -from django.core.files.storage import FileSystemStorage -from django.http import HttpResponseRedirect, HttpResponseForbidden -from django.conf import settings -from django.contrib.auth.decorators import login_required -from django.utils.decorators import method_decorator -from django.core.exceptions import PermissionDenied - -import os -from photologue.models import Photo -from exposition.models import Exposition -from functions.form_check import translit_with_separator -from accounts.models import User -from country.models import Country -from city.models import City -from place_exposition.models import PlaceExposition -from theme.models import Tag, Theme - -class LoginRequiredMixin(object): - @method_decorator(login_required) - def dispatch(self, request, *args, **kwargs): - if not request.user.organiser: - raise PermissionDenied - return super(LoginRequiredMixin, self).dispatch(request, *args, **kwargs) - - -# defining different template for every form -TEMPLATES = { - '0': 'client/wizard/first_step.html', - '1': 'client/wizard/second_step.html', - '2': 'client/wizard/third_step.html' -} - - -class ExpoWizard(LoginRequiredMixin, SessionWizardView): - - """main view that handle all data from 3 forms(steps) and finally create an Exposition""" - - # storing temporary files during upload - location = os.path.join(settings.MEDIA_ROOT, 'temp') - file_storage = FileSystemStorage(location, settings.MEDIA_URL) - SUCCESS_URL = "/" - - def get_template_names(self): - return [TEMPLATES[self.steps.current]] - - def done(self, form_list, **kwargs): - # getting data and files - upload_logo = form_list[0].cleaned_data.get('logo') - upload_images = self.request.FILES.getlist(u'2-attachments') - data = self.get_all_cleaned_data() - - # creating new exposition - lang = self.request.LANGUAGE_CODE - expo = Exposition.objects.language(lang).create( - name=data.get('name'), - data_begin=data.get('date_start'), - data_end=data.get('date_end'), - main_title=data.get('main_title'), - description=data.get('description'), - products=data.get('products'), - - country=Country.objects.language(lang).get(id=data.get('country')), - city=City.objects.language(lang).get(id=data.get('city')), - place=PlaceExposition.objects.language(lang).get(id=data.get('place')), - - periodic=data.get('periodic'), - web_page=data.get('web_site'), - logo=data.get('logo'), - - foundation_year=data.get('found_year'), - area=data.get('square'), - price_day=data.get('one_day'), - price_all=data.get('all_days'), - price_day_bar=data.get('pre_one_day'), - price_all_bar=data.get('pre_all_days'), - - min_area=data.get('min_square'), - registration_payment=data.get('registration_depos'), - application_deadline=data.get('deadline_date'), - min_closed_area=data.get('unequiped'), - min_open_area=data.get('open_square'), - min_closed_equipped_area=data.get('equiped'), - url=translit_with_separator(data.get('name')), - quality_label=0, - audience=0, - creator=User.objects.get(id=self.request.user.id) - ) - # adding photo to gallery - photos = [] - for i, photo in enumerate(upload_images): - photos.append(Photo.objects.language(self.request.LANGUAGE_CODE).create( - image=photo, - title=data.get(u'pdescr_%i' % i, photo.name)) - ) - for photo in photos: - expo.upload_photo(photo) - - expo.tag = Tag.objects.language(lang).filter(id__in=data.get('tag').split(',')) - expo.theme = Theme.objects.language(lang).filter(id__in=data.get('theme')) - - # setting bit fields audience and quality_label - self.set_flags(expo, data) - expo.save() - - # remove temporary files if it has any - if upload_logo: - self.file_storage.delete(upload_logo.name) - if upload_images: - for f in upload_images: - self.file_storage.delete(f.name) - - return HttpResponseRedirect(self.SUCCESS_URL) - - @staticmethod - def set_flags(expo, data): - if data['membership1']: - expo.quality_label = (expo.quality_label | Exposition.quality_label.exporating) - if data['membership2']: - expo.quality_label = (expo.quality_label | Exposition.quality_label.rsva) - if data['membership3']: - expo.quality_label = (expo.quality_label | Exposition.quality_label.ufi) - - if data['audience1']: - expo.audience = (expo.audience | Exposition.audience.experts) - if data['audience2']: - expo.audience = expo.audience | getattr(Exposition.audience, 'experts and consumers') - if data['audience3']: - expo.audience = expo.audience | (getattr(Exposition.audience, 'general public')) - - diff --git a/requirements.txt b/requirements.txt index 3cb5922b..b366156d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,6 @@ django-haystack==2.3.2 django-hvad==1.2.0 django-model-utils==2.2 django-modeltranslation==0.12 -django-multiupload==0.5 django-redis==4.0.0 django-redis-cache==0.13.1 django-rosetta==0.7.6 diff --git a/templates/client/wizard/first_step.html b/templates/client/wizard/first_step.html deleted file mode 100644 index b5eb43d2..00000000 --- a/templates/client/wizard/first_step.html +++ /dev/null @@ -1,209 +0,0 @@ -{% extends 'client/base_catalog.html' %} -{% load static %} -{% load i18n %} - -{% block head_scripts %} - - -{% endblock %} - -{% block content_list %} - {{ form.errors }} -
-
-
- {{ wizard.form.media }} -

{% blocktrans with step=wizard.steps.step1%}Шаг {{ step }}. Основная информация{% endblocktrans %}

-
-
{% csrf_token %} - {{ wizard.management_form }} - {% with wizard.form as form %} -
-
-
- - {{ form.theme }} -
-
- - {{ form.tag }} -
-
-
- -

{% trans "Описание выставки" %}

- -
-
- {{ form.name }} -
-
- -
-
- {{ form.main_title }} -
-
- -
-
- {{ form.description }} -
-
- -
- -
- - -
-
-
- - {{ form.date_start }} -
-
- - {{ form.date_end }} -
-
-
-
- -
- -
- -

{% trans "Локация" %}

- -
-
-

{% trans "Место проведения:" %}

- {{ form.place }} -
-
- -
-
-

{% trans "Страна:" %}

- {{ form.country }} -
- -
-

{% trans "Город:" %}

- {{ form.city }} -
-
- -
-
- -
-

{% trans "Дополнительная информация" %}

- -
- - -
- -
-
- - - -
- -
- {% trans "Периодичность:" %} - {{ form.periodic }} -
-
- -
- -
-
- -
- - -
- - - -
-
-
- -
-
- {{ form.web_site }} - - {{ form.products }} - -
- -
-
- -
- - -
-
-
- - {{ form.time_start }} -
- -
- - {{ form.time_end }} -
-
-
-
- -
-
- - - -
-
-
- -
- -
- -
- -
- - {% endwith %} -
- -
-
-

{% trans "Шаг 2. Статистика и условия участия" %}

-
-
- -
-
-

{% trans "Шаг 3. Добавление фото" %}

-
-
- -
-
-{% endblock %} diff --git a/templates/client/wizard/second_step.html b/templates/client/wizard/second_step.html deleted file mode 100644 index 6d8dd833..00000000 --- a/templates/client/wizard/second_step.html +++ /dev/null @@ -1,259 +0,0 @@ -{% extends 'client/base_catalog.html' %} -{% load static %} -{% load i18n %} - -{% block head_scripts %} - - -{% endblock %} - - -{% block content_list %} - {{ form.errors }} -
-

{% trans "Добавить событие" %}

-
-
-
{% csrf_token %} - - {{ wizard.form.media }} -
-
-

{% trans "Шаг 1. Основная информация" %}

- -
- -
-
-
- - -
-
-

{% trans "Шаг 2. Статистика и условия участия" %}

- -
-
{% blocktrans %}+ 0,9 баллов к рейтингу{% endblocktrans %}
-
-
- - {{ wizard.management_form }} - {% if wizard.form.forms %} - {{ wizard.form.management_form }} - {% for form in wizard.form.forms %} - {{ form }} - {% endfor %} - {% else %} - {% with wizard.form as form %} -
- -
- -
- - {{ form.found_year }} -
- -
-
- -
- -

{% trans "Стоимость посещения и участия" %}

- -
-
- -
-
- -
{% trans "Стоимость билетов" %}
- -
- -
    - -
  • - {{ form.one_day }} - -
  • - -
  • - {{ form.all_days }} - -
  • - -
- -
{% trans "Предварительная регистрация" %}
- -
- -
- -
- -
    - -
  • - {{ form.pre_one_day }} - -
  • - -
  • - {{ form.pre_all_days }} - -
  • - -
- -
{% trans "Регистрация на стойке" %}
- -
- -
- -
- -
-
- -
{% trans "Стоимость аренды 1м²" %}
- -
    - -
  • - {{ form.equiped }} - -
  • - -
  • - {{ form.unequiped }} - -
  • - -
  • - {{ form.open_square }} - -
  • - -
- -
- -
- - -
- {{ form.min_square }} - м² -
-
- -
- -
- - -
- {{ form.registration_depos }} - -
-
- -
- -
- - -
-
-
- {{ form.deadline_date }} -
-
-
-
- -
-
- -
-
- -
- -
- -
-
- {# #} - -
-

{% trans "более полная информация повышает рейтинг вашего мероприятия и позволяет ранжировать его выше других" %}

-
-
- -
- - -
- -
-
-
-

{% trans "Шаг 3. Добавление фото" %}

- - -
-
- -
- - {% endwith %} - {% endif %} - -{% endblock %} diff --git a/templates/client/wizard/third_step.html b/templates/client/wizard/third_step.html deleted file mode 100644 index f1ae1f07..00000000 --- a/templates/client/wizard/third_step.html +++ /dev/null @@ -1,147 +0,0 @@ -{% extends "client/base_catalog.html" %} -{% load i18n %} - -{% block styles %} - -{% endblock %} - -{% block content_list %} - {{ wizard.form.media }} - -
-

{% trans "Добавить событие" %}

-
- -
-
{% csrf_token %} - - -
-
-

{% trans "Шаг 1. Основная информация" %}

- -
- -
- -
-
-
-
-

{% trans "Шаг 2. Статистика и условия участия" %}

- -
- -
-
-
-
-
-

{% trans "Шаг 3. Добавление фото" %}

- -
-
{% blocktrans %}+ 1,2 балла к рейтингу{% endblocktrans %}
-
-
- {{ form.errors }} - {{ wizard.management_form }} - {% if wizard.form.forms %} - {{ wizard.form.management_form }} - {% for form in wizard.form.forms %} - {{ form }} - {% endfor %} - {% else %} - {% with wizard.form as form %} -
-
-
-
- {{ form.attachments }} -
- -
-

{% trans "более полная информация повышает рейтинг вашего мероприятия и позволяет ранжировать его выше других" %}

-
-
- -
- -
    -
    - -
    - -
    - -
    - -
    -
    - -
    - {% endwith %} - {% endif %} -
    -
    - -
    - - {% comment %} {% endcomment %} - - -{% endblock %} diff --git a/templates/client/wizard/wizard.html b/templates/client/wizard/wizard.html deleted file mode 100644 index 4288417d..00000000 --- a/templates/client/wizard/wizard.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends 'client/base_catalog.html' %} -{% load i18n %} - -{% block content_list %} - {{ wizard.form.media }} -

    {% blocktrans with step=wizard.steps.step1 count=wizard.steps.count %}Step {{ step }} of {{ count }}{% endblocktrans %}

    -
    {% csrf_token %} - -{{ wizard.management_form }} -{% if wizard.form.forms %} - {{ wizard.form.management_form }} - {% for form in wizard.form.forms %} - {{ form }} - {% endfor %} -{% else %} - {{ wizard.form }} -{% endif %} -
    -{% if wizard.steps.prev %} - - -{% endif %} - -
    -{% endblock %} From bf8876556464cbb445dbc663832f10bc4a00542d Mon Sep 17 00:00:00 2001 From: Slava Kyrachevsky Date: Mon, 23 Jan 2017 16:41:21 +0200 Subject: [PATCH 4/5] =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/company/admin.py | 1 - apps/emencia/django/newsletter/admin_forms.py | 2 - apps/functions/custom_views.py | 1 - apps/functions/utils.py | 1 - apps/place_exposition/models.py | 9 +- apps/settings/forms.py | 1 - apps/theme/models.py | 8 +- .../client/includes/exposition/tags.html | 8 +- .../client/includes/index/main_events.html | 72 ----- templates/client/index.html | 293 +++++++++++------- 10 files changed, 196 insertions(+), 200 deletions(-) delete mode 100644 templates/client/includes/index/main_events.html diff --git a/apps/company/admin.py b/apps/company/admin.py index a2a0f843..0b0c6598 100644 --- a/apps/company/admin.py +++ b/apps/company/admin.py @@ -43,7 +43,6 @@ def company_delete(request, url): @login_required def company_change(request, url): - print('URL\n' + url) """ Return form and fill it with existing Company object data. diff --git a/apps/emencia/django/newsletter/admin_forms.py b/apps/emencia/django/newsletter/admin_forms.py index b984140f..ed8b7029 100644 --- a/apps/emencia/django/newsletter/admin_forms.py +++ b/apps/emencia/django/newsletter/admin_forms.py @@ -276,14 +276,12 @@ class NewsletterRecommendForm(forms.ModelForm): def clean_event(self): event = self.cleaned_data.get('event') - print(event) match = self.rx.match(event) if not match: raise forms.ValidationError(_(u'Введены неверные данные')) model = self.event_models.get(match.group('type')) self.event_model = model event_id = match.group('pk') - print(model, event_id, event) try: event = model.objects.get(pk=event_id) except model.DoesNotExist: diff --git a/apps/functions/custom_views.py b/apps/functions/custom_views.py index e70ef018..b4f26f5e 100644 --- a/apps/functions/custom_views.py +++ b/apps/functions/custom_views.py @@ -486,7 +486,6 @@ class SimpleObjectChangeView(RedirectView, SingleObjectMixin): def get(self, request, *args, **kwargs): self.object = self.get_object() self.change_object() - print(self.request.META.get('QUERY_STRING', '')) return super(SimpleObjectChangeView, self).get(request, *args, **kwargs) diff --git a/apps/functions/utils.py b/apps/functions/utils.py index 66b4aaf4..89498487 100644 --- a/apps/functions/utils.py +++ b/apps/functions/utils.py @@ -21,7 +21,6 @@ def strfdelta(tdelta, fmt): class CachedSting(object): def __init__(self, path, timeout=None): super(CachedSting, self).__init__() - print('initiated', path) self.path = path self.timeout = timeout or timedelta(days=1) self.get_object() diff --git a/apps/place_exposition/models.py b/apps/place_exposition/models.py index f700cc5b..8ce1b19e 100644 --- a/apps/place_exposition/models.py +++ b/apps/place_exposition/models.py @@ -196,8 +196,13 @@ class PlaceExposition(TranslatableModel, ExpoMixin): if not self.address: return [] # get coordinates of all hotels in current city - qs_hotels_all = self.city.hotels.filter(city=self.city) - hotels_coord = [(hotel.latitude, hotel.longitude) for hotel in qs_hotels_all] + qs_hotels_all = self.city.hotels.language().filter( + city=self.city + ).values( + 'latitude', 'longitude', 'url', 'photo', 'name', + 'min_price', 'currency' + ) + hotels_coord = [(hotel['latitude'], hotel['longitude']) for hotel in qs_hotels_all] # coordinate current place place_coord = (float(self.address['lat']), float(self.address['lng'])) # 4 coordinates of 4 nearest hotels diff --git a/apps/settings/forms.py b/apps/settings/forms.py index e2638138..63c4758b 100644 --- a/apps/settings/forms.py +++ b/apps/settings/forms.py @@ -197,7 +197,6 @@ class EventDefaultDescriptionEditForm(forms.Form): for field_name, path in templates.iteritems(): try: with open(os.path.join(settings.SITE_ROOT, path), 'w+') as f: - print(self.cleaned_data.get(field_name)) f.write(self.cleaned_data.get(field_name).encode('utf-8')) except Exception as e: print(e) diff --git a/apps/theme/models.py b/apps/theme/models.py index d8e1b3c5..c5c2736e 100644 --- a/apps/theme/models.py +++ b/apps/theme/models.py @@ -63,19 +63,19 @@ class Theme(TranslatableModel): def expositions_number(self): - return Exposition.enable.upcoming().filter(theme__id=self.id).count() + return Exposition.enable.upcoming().filter(theme=self).count() def conferences_number(self): - return Conference.enable.upcoming().filter(theme__id=self.id).count() + return Conference.enable.upcoming().filter(theme=self).count() def seminars_number(self): - return Seminar.objects.filter(theme__id=self.id).count() + return Seminar.objects.filter(theme=self).count() def webinars_number(self): - return Webinar.objects.filter(theme__id=self.id).count() + return Webinar.objects.filter(theme=self).count() def events_number(self): return self.expositions_number() + self.conferences_number() + self.seminars_number() + self.webinars_number() diff --git a/templates/client/includes/exposition/tags.html b/templates/client/includes/exposition/tags.html index 71c42583..9320e937 100644 --- a/templates/client/includes/exposition/tags.html +++ b/templates/client/includes/exposition/tags.html @@ -1,5 +1,3 @@ -{% with tags=obj.tags %} - {% for tag in tags %} - {{ tag.name }}{% if forloop.counter != tags|length %},{% endif %} - {% endfor %} -{% endwith %} \ No newline at end of file +{% for tag in obj.tags.all %} + {{ tag.name }}{% if not forloop.last %},{% endif %} +{% endfor %} diff --git a/templates/client/includes/index/main_events.html b/templates/client/includes/index/main_events.html deleted file mode 100644 index c2c68afa..00000000 --- a/templates/client/includes/index/main_events.html +++ /dev/null @@ -1,72 +0,0 @@ -{% load thumbnail %} -{% load i18n %} -{% load template_filters %} - - - -
    - -
    - -
    - - -
    -
    -
    \ No newline at end of file diff --git a/templates/client/index.html b/templates/client/index.html index 55dcb0ab..2a8f2519 100644 --- a/templates/client/index.html +++ b/templates/client/index.html @@ -1,152 +1,223 @@ -{% extends "blank.html" %} -{% load static %} -{% load i18n %} +{% extends "client/blank.html" %} +{% load static i18n %} {% load thumbnail %} {% load template_filters %} + {% block styles %} {% endblock %} + {% block body_class %} class="main-page" {% endblock %} {% block top %} -
    -
    - - - - {% include 'client/includes/index/main_events.html' with events=events %} - -
    -
    +
    +
    + + + +
    + +
    + +
    + + +
    +
    +
    + + + + + +
    +
    {% endblock %} {% block search %} - {% include 'client/includes/catalog_search_main.html' with search_form=search_form %} + {% include 'client/includes/catalog_search_main.html' with search_form=search_form %} {% endblock %} {% block catalog %} -
    -
    +
    +
    - -
    -
    +
    +
    -
    - {% include 'client/includes/index/expos.html' with themes=exposition_themes %} -
    +
    + {% include 'client/includes/index/expos.html' with themes=exposition_themes %} +
    -
    - {% include 'client/includes/index/confs.html' with themes=conference_themes %} -
    +
    + {% include 'client/includes/index/confs.html' with themes=conference_themes %} +
    -
    +
    {% include 'client/includes/banners/main_page_inner.html' %} -
    +
    -
    -
    +
    +
    {% endblock %} + {% block announces %} -
    -
    - - -
    - +
    + +
    +
    {% endblock %} {% block partners %} -
    -
    -
    {% trans 'Наши партнеры:' %}
    -
      -
    • -
    • -
    • - {% comment %} -
    • - {% endcomment %} -
    • -
    • -
    -
    -
    +
    +
    +
    {% trans 'Наши партнеры:' %}
    +
      +
    • +
    • +
    • + {% comment %} +
    • + {% endcomment %} +
    • +
    • +
    +
    +
    {% endblock %} {% block services %} -
    -
    - -
    -
    - {% include 'client/includes/index/blogs.html' with blogs=blogs %} -
    -
    -
    -
    +
    +
    + +
    +
    + {% include 'client/includes/index/blogs.html' with blogs=blogs %} +
    +
    +
    +
    {% if request.GET.debug == '1' %} From 48789b07ee80e8d2094ad74f2f401b70d13b35d2 Mon Sep 17 00:00:00 2001 From: Slava Kyrachevsky Date: Tue, 24 Jan 2017 16:08:54 +0200 Subject: [PATCH 5/5] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20collectstatic=20?= =?UTF-8?q?=D1=81=20=D0=BC=D0=B0=D1=81=D1=82=D0=B5=D1=80=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=82=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proj/settings.py | 7 ++----- support/nginx.conf | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/proj/settings.py b/proj/settings.py index 8a9f363a..4e424535 100644 --- a/proj/settings.py +++ b/proj/settings.py @@ -90,10 +90,7 @@ USE_L10N = False USE_TZ = False -MEDIA_ROOT = os.path.join(SITE_ROOT, 'media/') CKEDITOR_UPLOAD_PATH = os.path.join(SITE_ROOT, 'media/upload') - - CKEDITOR_CONFIGS = { 'default': { 'toolbar': 'standart', @@ -119,11 +116,12 @@ CKEDITOR_CONFIGS = { } MEDIA_URL = '/media/' +MEDIA_ROOT = os.path.join(SITE_ROOT, 'media/') STATIC_URL = '/static/' STATIC_ROOT = os.path.join(SITE_ROOT, 'collected_static') STATICFILES_DIRS = ( - 'static', + os.path.join(SITE_ROOT, 'static'), ) STATICFILES_FINDERS = ( @@ -461,7 +459,6 @@ HAYSTACK_CONNECTIONS = { """ -THUMBNAIL_DEBUG = DEBUG THUMBNAIL_ENGINE = "proj.sorlengine.SorlEngine" THUMBNAIL_FORMAT = "PNG" diff --git a/support/nginx.conf b/support/nginx.conf index a3e287f3..63bd32d9 100644 --- a/support/nginx.conf +++ b/support/nginx.conf @@ -45,7 +45,7 @@ server { location /static { access_log off; expires max; - root /home/www/proj; + alias /home/www/proj/collected_static; } location /media { @@ -57,7 +57,7 @@ server { location /templates { access_log off; expires max; - root /home/www/proj/static; + alias /home/www/proj/collected_static/templates; } }