Merge branch 'stage6' of bitbucket.org:Bonus_05/expomap into stage6

remotes/origin/stage6
ya_dim4ik 9 years ago
commit a06d85ca61
  1. 3
      accounts/views.py
  2. 24
      emencia/django/newsletter/models.py
  3. 4
      expobanner/admin.py
  4. 10
      fabfile.py
  5. 30
      functions/pipeline.py
  6. 30
      proj/forms.py
  7. 4
      proj/middleware.py
  8. 2
      registration/backends/default/views.py
  9. 7
      requirements.txt
  10. 1
      support/dev/settings.py
  11. 1
      support/prod/settings.py
  12. 45
      templates/c_admin/service/order_list.html
  13. 30
      templates/client/accounts/mailing_settings.html
  14. 10
      templates/client/accounts/settings.html
  15. 2
      templates/client/base_catalog.html
  16. 2
      templates/client/conference/conference_by.html
  17. 2
      templates/client/exposition/exposition_by.html
  18. 5
      templates/client/includes/header.html
  19. 2
      templates/client/includes/reverseorder_warning.html
  20. 19
      templates/client/includes/side_popular.html
  21. 6
      templates/client/popups/register.html
  22. 28
      templates/client/popups/unsubscribed.html
  23. 23
      templates/registration/acquire_email.html

@ -158,8 +158,7 @@ class MailingSettingsUnsubscribe(GetUserMixin, RedirectView):
if contact is None:
return HttpResponseForbidden()
if contact.subscriber:
contact.subscriber = False
contact.save()
contact.unsubscribe()
return super(MailingSettingsUnsubscribe, self).get(request, *args, **kwargs)

@ -161,7 +161,7 @@ class Contact(models.Model):
periodic = models.PositiveSmallIntegerField(_(u'Периодичность отправки'),
choices=PERIODIC_CHOICES, default=PERIODIC_CHOICES.WEEK)
periodic_day = models.PositiveSmallIntegerField(_(u'День отправки'),
choices=PERIODIC_DAY_CHOICES, default=PERIODIC_DAY_CHOICES.MON)
choices=PERIODIC_DAY_CHOICES, default=PERIODIC_DAY_CHOICES.WED)
content_news = models.BooleanField(_(u'Новости событий'), blank=True, default=True)
content_overview = models.BooleanField(_(u'Обзоры'), blank=True, default=True)
content_articles = models.BooleanField(_(u'Статьи из блога по участию в вывставках'), blank=True, default=True)
@ -178,6 +178,20 @@ class Contact(models.Model):
objects = ContactManager()
def unsubscribe(self):
self.subscriber = False
self.moscow = False
self.russia = False
self.foreign = False
self.content_news = False
self.content_overview = False
self.content_articles = False
self.tags.clear()
self.themes.clear()
self.f_countries.clear()
self.r_cities.clear()
self.save()
def subscriptions(self):
"""Return the user subscriptions"""
return MailingList.objects.filter(subscribers=self)
@ -265,9 +279,11 @@ class Contact(models.Model):
if self.russia:
r_cities = set(self.r_cities.values_list('pk', flat=True))
r_date = date + relativedelta.relativedelta(months=1)
russia_sqs = SearchQuerySet().models(Exposition, Conference)\
.filter(country_id=Exact(settings.RUSSIA_PK), data_begin__gte=r_date)\
.exclude(city_id=Exact(settings.MOSCOW_PK))
russia_sqs = SearchQuerySet().models(Exposition, Conference) \
.filter(country_id=Exact(settings.RUSSIA_PK), data_begin__gte=r_date) \
# .exclude(city_id=Exact(settings.MOSCOW_PK))
if r_cities or self.moscow:
russia_sqs = russia_sqs.exclude(city_id=Exact(settings.MOSCOW_PK))
if r_cities:
russia_sqs = russia_sqs.filter(city_id__in=r_cities)
if th_tg_filter is not None:

@ -4,6 +4,7 @@ from itertools import chain
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.contrib import admin
from django.db.models import Q, Sum
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
@ -50,6 +51,9 @@ from settings.forms import CommentForm, HtmlForm, ParticipationCommentForm
from settings.models import Html, LandingComment, ParticipationComment
admin.site.register(BannerGroup)
class BannersControl(TemplateView):
template_name = 'c_admin/expobanner/banners_control.html'

10
fabfile.py vendored

@ -15,7 +15,7 @@ env.passwords = {
}
REMOTE_HOME_DIR = '/home/www/expomap/'
LOCAL_HOME_DIR = '/home/alexander/projects/expomap/'
LOCAL_HOME_DIR = '/home/as/PycharmProjects/expomap/'
nginx_conf_tech = '/etc/nginx/sites-available/tech_work_hit.expomap.ru'
nginx_conf = '/etc/nginx/sites-available/hit.expomap.ru'
@ -86,14 +86,14 @@ def get_configs():
def put_configs():
localdir = join(LOCAL_HOME_DIR, 'support/', env.role)
# nginx
put(join(localdir, basename(nginx_conf)),
nginx_conf)
# put(join(localdir, basename(nginx_conf)),
# nginx_conf)
# # apache2
# put(join(localdir, basename(apache2_conf)),
# apache2_conf)
# settings
# put(join(localdir, basename(settings_conf)),
# settings_conf)
put(join(localdir, basename(settings_conf)),
settings_conf)
def newsletters_media():

@ -9,10 +9,11 @@ from django.contrib.sites.models import RequestSite, Site
from django.core import signing
from django.core.mail import EmailMultiAlternatives
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.shortcuts import redirect, render
from registration import signals
from registration.models import RegistrationProfile
from social.pipeline.partial import partial
from proj.forms import EmailForm, AssociateForm
def random_pass():
@ -60,18 +61,21 @@ def create_user(strategy, details, response, uid, user=None, *args, **kwargs):
def require_email(strategy, details, user=None, is_new=False, *args, **kwargs):
if user and user.email:
return
elif is_new and not details.get('email'):
email = strategy.request_data().get('email')
import pdb; pdb.set_trace()
if not email:
strategy.request.session['new_email'] = True
return redirect('acquire_email')
elif email and not User.objects.filter(email=email).exists():
details['email'] = email
else:
strategy.request.session['new_email'] = True
strategy.request.session['new_email_invalid'] = True
return redirect('acquire_email')
email = details.get('email')
if is_new and not email:
form = EmailForm(strategy.request.POST or None)
if strategy.request.method == "POST" and form.is_valid():
email = form.cleaned_data.get('email')
if not User.objects.filter(email=email).exists():
details['email'] = email
return {'email': email}
else:
form = AssociateForm(strategy.request.POST or None)
if form.is_valid() and form.user:
details['email'] = email
return {'email': email, 'user': form.user}
return render(strategy.request, "registration/acquire_email.html", {'form': form})
return
def SendVerificationEmail(strategy, backend, code):

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext as _
from accounts.models import User
class EmailForm(forms.Form):
email = forms.EmailField(label=_(u'Email address'))
class AssociateForm(EmailForm):
_errors = {
'required': _(u'Данный email уже зарегистрирован. Авторизируйтесь чтобы привязать аккаунт.'),
'invalid': _(u'Неправильный логин или пароль.')
}
password = forms.CharField(label=_(u'Пароль'), widget=forms.PasswordInput(), error_messages=_errors)
def clean_password(self):
self.user = None
pw = self.cleaned_data.get('password')
if pw:
try:
self.user = User.objects.get(email=self.cleaned_data.get('email'))
except:
self.user = None
if self.user and not self.user.check_password(pw):
self.user = None
raise forms.ValidationError(self.fields['password'].error_messages['invalid'])
return pw

@ -66,8 +66,8 @@ class Referer(object):
request.session[attr2] = val
if userlog is not None:
setattr(userlog, attr2, val)
if not getattr(userlog, attr1):
setattr(userlog, attr1, val)
if not getattr(userlog, attr1):
setattr(userlog, attr1, val)
if not request.session.get(attr1):
request.session[attr1] = val
if userlog is not None:

@ -248,7 +248,7 @@ def LoginView(request):
return HttpResponse(json.dumps(response), content_type='application/json')
else:
HttpResponseRedirect('/')
return HttpResponseRedirect('/')
def complete_registration(request):

@ -51,3 +51,10 @@ vobject==0.8.2
wstools==0.4.3
xlrd==0.9.2
xlwt==0.7.5
rosetta
scipy
numpy
nltk
pandas
django-modeltranslation
suds

@ -332,6 +332,7 @@ INSTALLED_APPS = (
'emencia.django.newsletter',
'accounts',
'article',
'comments',
'city',
'company',
'conference',

@ -332,6 +332,7 @@ INSTALLED_APPS = (
'emencia.django.newsletter',
'accounts',
'article',
'comments',
'city',
'company',
'conference',

@ -1,4 +1,5 @@
{% extends 'base.html' %}
{% load i18n %}
{% block body %}
@ -18,17 +19,53 @@
</thead>
<tbody>
{% for item in object_list %}
<tr>
<tr>
<td>{{ item.id }}</td>
<td>{{ item.person_inf }}</td>
<td>{{ item.phone }}</td>
<td>{{ item.created }}</td>
</tr>
<td>{{ item.phone }}</td>
<td>{{ item.created }}</td>
</tr>
<tr style="display: none" class="addition">
<td>
{% trans "Первый переход" %}
<br>{% trans "Последний переход" %}
<br>{% trans "utm_source1" %}
<br>{% trans "utm_medium1" %}
<br>{% trans "utm_campaign1" %}
<br>{% trans "utm_source2" %}
<br>{% trans "utm_medium2" %}
<br>{% trans "utm_campaign2" %}
<br>{% trans "search1" %}
<br>{% trans "search2" %}
<br>{% trans "search3" %}
</td>
<td colspan="3">
{{ item.referer1 }}
<br>{{ item.referer2 }}
<br>{{ item.utm_source1 }}
<br>{{ item.utm_medium1 }}
<br>{{ item.utm_campaign1 }}
<br>{{ item.utm_source2 }}
<br>{{ item.utm_medium2 }}
<br>{{ item.utm_campaign2 }}
<br>{{ item.search1 }}
<br>{{ item.search2 }}
<br>{{ item.search3 }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script type="application/javascript">
$(document).ready(function () {
$('div.box-content table tr:not(.addition)').click(function () {
$(this).next().toggle();
})
});
</script>
{% include 'c_admin/includes/admin_pagination.html' with page_obj=page_obj %}
</div>
{# pagination #}

@ -10,6 +10,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="{% static 'mailing_settings/css/main.css' %}">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" defer></script>
</head>
<body>
@ -17,23 +18,17 @@
<div class="container">
<div class="logo_block">
<a href="/"><img src="{% static 'mailing_settings/images/logo.png' %}" alt="Expomap"></a>
<a href="#" class="back_to_site">expomap.ru <span>&#8250;</span></a>
<a href="/" class="back_to_site">expomap.ru <span>&#8250;</span></a>
</div>
<h1>{% trans 'Настройте рассылку от Expomap' %}</h1>
</div>
</header>
{% if not object.subscriber %}
<div class="reversed" style="border-left: 5px solid #ff9900; padding: 8px 12px; background-color: #fff; font-size:17px; text-align: justify; margin-bottom: 10px">
{% trans "Вы не являетесь подписчиком. Чтобы подписаться, выберите интересующие Вас данные." %}
</div>
{% endif %}
<form action="." method="post" id="mailing_settings_form">
{% csrf_token %}
<div class="themes_block">
<div class="container">
<h2>{% trans 'Какие письма вы хотите получать от нас?' %}</h2>
<h2>{% trans 'Какие события включать в Ваше письмо?' %}</h2>
<div class="columns">
<div class="column">
@ -107,16 +102,19 @@
<div class="column">
{{ form.content_news }}
{{ form.content_news.label_tag }}
<br>{% trans "Получайте новости выставок и конференций по выбранным тематикам" %}
</div>
<div class="column">
{{ form.content_overview }}
{{ form.content_overview.label_tag }}
<br>{% trans "Практические материалы, интервью, кейсы, которые помогут эффективно участвовать в выставках" %}
</div>
<div class="column">
{{ form.content_articles }}
{{ form.content_articles.label_tag }}
<br>{% trans "Блог о том, как создавать и продвигать крутые event`ы" %}
</div>
</div>
</div>
@ -179,9 +177,12 @@
<div id="countries_modal">
{% include 'client/popups/mailing_settings_countries.html' %}
</div>
<div id="unsibscribed_modal">
{% include 'client/popups/unsubscribed.html' %}
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.pack.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.js" defer></script>
<script type="application/javascript">
@ -213,6 +214,17 @@
// };
</script>
<script src="{% static 'mailing_settings/js/main.js' %}" defer></script>
{% if not object.subscriber %}
<script>
$(document).ready(function() {
var popupUnsibscribed = $('#unsibscribed');
$.fancybox(popupUnsibscribed, fbPopupOptions);
});
</script>
{# <div class="reversed" style="border-left: 5px solid #ff9900; padding: 8px 12px; background-color: #fff; font-size:17px; text-align: justify; margin-bottom: 10px">#}
{# {% trans "Вы не являетесь подписчиком. Чтобы подписаться, выберите интересующие Вас данные." %}#}
{# </div>#}
{% endif %}
</body>
</html>

@ -112,10 +112,10 @@
</div>
</div>
-->
<div class="set-sect subscribe">
<header>{% trans 'настройка подписки' %}</header>
<a href="{% url 'accounts-mailing_settings' %}" >{% trans 'Перейти к настройке' %}</a>
<span><img style="margin-right: -2px; margin-bottom: 4px;" src="{% static 'img/announce-letter.png' %}"></span>
{# <div class="set-sect subscribe">#}
{# <header>{% trans 'настройка подписки' %}</header>#}
{# <a href="{% url 'accounts-mailing_settings' %}" >{% trans 'Перейти к настройке' %}</a>#}
{# <span><img style="margin-right: -2px; margin-bottom: 4px;" src="{% static 'img/announce-letter.png' %}"></span>#}
{% comment %}
<div class="set-sect-body">
<form action="." method="post">
@ -194,7 +194,7 @@
</div>
{% endcomment %}
</div>
{# </div>#}
{% block scripts %}
<script>

@ -36,7 +36,7 @@
{% include 'client/includes/announces.html' %}
{% include 'client/includes/side_popular.html' %}
{# {% include 'client/includes/side_popular.html' %}#}
{% include 'client/includes/side_confs.html' %}

@ -23,6 +23,8 @@
{% endblock %}
{% block content_list %}
{% include 'client/includes/side_popular.html' %}
{% for obj in object_list %}
{% set cur_word = obj.name %}
{% if cur_word|slice:":1"|lower != prev_word|slice:":1"|lower and forloop.counter != 1 %}

@ -23,6 +23,8 @@
{% endblock %}
{% block content_list %}
{% include 'client/includes/side_popular.html' %}
{% with objects=object_list %}
{% for obj in objects %}
{% set cur_word = obj.name %}

@ -78,7 +78,10 @@
<a class="cl-btn icon-cal" href="{% url 'account_calendar' %}">{% trans 'календарь' %}</a>
<a class="cl-btn icon-doc" href="/profile/feed/">{% trans 'документы' %}</a>
</div>
<div class="clb-messages"><a class="icon-msg" href="/profile/messages/">{% if messages_inbox_count %} {{ messages_inbox_count }} {% endif %}</a></div>
<div class="clb-messages">
<a class="icon-msg" style="float: left;" href="/profile/messages/">{% if messages_inbox_count %} {{ messages_inbox_count }} {% endif %}</a>
<a href="{% url 'accounts-mailing_settings' %}" style="font-size: 18px" target="_blank">@</a>
</div>
<div class="clb-settings">
<a class="cl-btn icon-gear" href="/profile/settings/">{% trans 'настройки' %}</a>
</div>

@ -1,5 +1,5 @@
{% load i18n %}
<div class="reversed" style="border-left: 5px solid #ff9900; padding: 8px 12px; background-color: #fff; font-size:17px; text-align: justify; margin-bottom: 10px">{% trans "Выставки по указанным параметрам не найдены. Попробуйте упростить параметры или расширить временные рамки. Также Вы можете посмотреть уже прошедшие события и проверить самостоятельно, будут ли они проходить в будущем." %}</div>
<div class="reversed" style="border-left: 5px solid #ff9900; padding: 8px 12px; background-color: #fff; font-size:17px; text-align: justify; margin-bottom: 10px">{% trans "Выставки по указанным параметрам не найдены. Попробуйте упростить параметры или расширить временные рамки. Также, вы можете посмотреть уже прошедшие события и проверить самостоятельно, будут ли они проходить в будущем." %}</div>
<div class="page-title">
<h2 style="font-size:30px;">{% trans "Прошедшие события" %}</h2>
</div>

@ -1,14 +1,15 @@
{% load i18n %}
{% if side_popular %}
<div class="mps-sect">
<header style="font-size: 23px;">{% trans 'Самые популярные' %}</header>
<nav>
<ul>
{% for obj in side_popular %}
<li><a href="{{ obj.url }}">{{ obj.name }}</a></li>
{% endfor %}
{# <div class="mps-sect">#}
{# <header style="font-size: 23px;">{% trans 'Самые популярные' %}</header>#}
{# <nav>#}
<ul class="leter-list">
<li class="leter" style="font-size: 24px">{% trans 'Самые популярные' %}</li>
{% for obj in side_popular %}
<li><a href="{{ obj.url }}">{{ obj.name }}</a></li>
{% endfor %}
</ul>
</nav>
</div>
{# </nav>#}
{# </div>#}
{% endif %}

@ -42,9 +42,9 @@
<div class="pwf-msg"><div class="msg-help">{% trans 'пароль должен иметь не меньше 6 символов' %}</div></div>
</div>
<div class="pwf-buttons-line pwf-line">
<div class="pwf-field">
<a href="{% url 'termsofuse' %}" style="color:#a2a2a2;">{% trans "Пользовательское соглашение" %}</a>
<a href="{% url 'termsofuse' %}" style="color:#a2a2a2;">{% trans "Пользовательское соглашение" %}</a>
<div class="pwf-buttons-line pwf-line" style="margin-top: 12px;">
<div class="pwf-field">
<button type="submit" class="icon-check">{% trans 'Зарегистрироваться' %}</button>
</div>
<div class="pwf-msg err-message-box pd-top-14 red"> {% trans "Ошибка" %}</div>

@ -0,0 +1,28 @@
{% load static %}
{% load i18n %}
{% load template_filters %}
<div id="unsibscribed" class="popup-window unsibscribed">
<header>
<div class="title">{% trans 'Вы отписались от нашей рассылки' %}</div>
</header>
<div class="body">
<div class="themes_wrapper">
<div class="scroll-container">
<div class="scroll-content">
<div class="topics-list">
{% trans "Мы расстроены, но отписали Вас от всех писем. Надеемся, в скором времени вы снова захотите быть в курсе событий своей отрасли." %}
</div>
</div>
</div>
<div class="wait-ajax"></div>
</div>
{# <div class="buttons_block">#}
{# <button class="modal-approve" type="button">{% trans 'Выбрать' %}</button>#}
{# <button class="modal-clear" type="button">{% trans 'Очистить' %}</button>#}
{# </div>#}
</div>
</div>

@ -6,21 +6,22 @@
{% block page_body %}
<h1>{% trans "Enter your email" %}</h1>
<div cl>
</div>
{% if form.errors %}
<p class="error">{% trans "Please correct the errors below:" %}</p>
<p class="error">{% trans "Please correct the errors below:" %}</p>
{% endif %}
<form class="form-inline" action="{% url "social:complete" backend=backend %}" method="post" role="form">{% csrf_token %}
<div class="form-group">
<div class="input-group">
<label class="control-label" for="id_email">{% trans "Email address:" %}</label>
<input class="form-control" id="id_email" type="email" name="email" placeholder="E-mail"/>
{# <input type="hidden" name="valid" value="no">#}
{% if invalid %}
{% trans "Такой Email уже существует." %}
{% endif %}
{# {% url "social:complete" backend=backend %}#}
<form class="form-inline" action="." method="post" role="form">{% csrf_token %}
{% for field in form %}
<div class="control-group {% if field.errors %}error{% endif %}">
<label class="control-label"><b>{{ field.label }}:</b></label>
<div class="controls">{{ field }}
<span class="help-inline">{{ field.errors }}</span>
</div>
</div>
</div>
{% endfor %}
<button class="btn btn-default" type="submit">{% trans "Submit" %}</button>
</form>

Loading…
Cancel
Save