remotes/origin/stage6
Alexander Burdeinyi 9 years ago
parent f7d2f25d10
commit 2043a7983e
  1. 2
      conference/urls.py
  2. 37
      conference/views.py
  3. 5
      emencia/django/newsletter/forms.py
  4. 5
      emencia/django/newsletter/models.py
  5. 2
      emencia/django/newsletter/templates/newsletter/AutomaticEmail.html
  6. 24
      emencia/django/newsletter/templates/newsletter/AutomaticEmail_web.html
  7. 10
      events/urls.py
  8. 20
      events/views.py
  9. 4
      expobanner/models.py
  10. 2
      exposition/urls.py
  11. 38
      exposition/views.py
  12. 2
      proj/urls.py
  13. 44
      templates/client/article/article.html
  14. 12
      templates/client/includes/visit_button.html

@ -25,7 +25,7 @@ urlpatterns = patterns('',
url(r'^conference/add-note/(?P<slug>[^/]*)/$', 'conference.views.add_note'), url(r'^conference/add-note/(?P<slug>[^/]*)/$', 'conference.views.add_note'),
url(r'^conference-add-calendar/(?P<id>\d+)/$', 'conference.views.conference_add_calendar'), url(r'^conference-add-calendar/(?P<id>\d+)/$', 'conference.views.conference_add_calendar'),
url(r'^conference-visit/(?P<id>\d+)/$', 'conference.views.conference_visit'), # url(r'^conference-visit/(?P<id>\d+)/$', 'conference.views.conference_visit'),
# search # search
url(r'^conference/search/', ExpositionSearchView.as_view()), url(r'^conference/search/', ExpositionSearchView.as_view()),
# country catalog # country catalog

@ -557,25 +557,26 @@ def conference_add_calendar(request, id):
return HttpResponse(json.dumps(args), content_type='application/json') return HttpResponse(json.dumps(args), content_type='application/json')
# перенесено в events
# def conference_visit(request, id):
# args = {'success': False}
# user = request.user
# if user.is_authenticated():
# conf = Conference.objects.safe_get(id=id)
# if user in conf.users.all():
# conf.users.remove(user)
# args['in'] = False
# else:
# conf.users.add(user)
# args['in'] = True
# args['success'] = True
#
# else:
# args['not_authorized'] = True
# args['success'] = True
#
# return HttpResponse(json.dumps(args), content_type='application/json')
def conference_visit(request, id):
args = {'success': False}
user = request.user
if user.is_authenticated():
conf = Conference.objects.safe_get(id=id)
if user in conf.users.all():
conf.users.remove(user)
args['in'] = False
else:
conf.users.add(user)
args['in'] = True
args['success'] = True
else:
args['not_authorized'] = True
args['success'] = True
return HttpResponse(json.dumps(args), content_type='application/json')
def add_note(request, slug): def add_note(request, slug):
args = {'success': False} args = {'success': False}

@ -165,9 +165,10 @@ class MailingSettingsForm(forms.ModelForm):
obj.area = areas obj.area = areas
obj.r_cities = self.cleaned_data.get('r_cities') or [] obj.r_cities = self.cleaned_data.get('r_cities') or []
if obj.moscow and not settings.MOSCOW_PK in obj.r_cities: r_cities = obj.r_cities.values_list('pk', flat=True)
if obj.moscow and not settings.MOSCOW_PK in r_cities:
obj.r_cities.add(settings.MOSCOW_PK) obj.r_cities.add(settings.MOSCOW_PK)
if not obj.moscow and settings.MOSCOW_PK in obj.r_cities: if not obj.moscow and settings.MOSCOW_PK in r_cities:
obj.moscow = True obj.moscow = True
obj.tags = self.cleaned_data.get('tg') or [] obj.tags = self.cleaned_data.get('tg') or []

@ -151,7 +151,7 @@ class Contact(models.Model):
) )
activated = models.BooleanField(default=False) activated = models.BooleanField(default=False)
from_users = models.BooleanField(default=False) from_users = models.BooleanField(default=False)
dailymailing = models.BooleanField(default=True) dailymailing = models.BooleanField(default=False)
moscow = models.BooleanField(_(u'Москва'), blank=True, default=True) moscow = models.BooleanField(_(u'Москва'), blank=True, default=True)
russia = models.BooleanField(_(u'Россия'), blank=True, default=True) russia = models.BooleanField(_(u'Россия'), blank=True, default=True)
@ -713,7 +713,8 @@ class Newsletter(models.Model):
qs = Contact.objects.subscribers().filter( qs = Contact.objects.subscribers().filter(
reduce(operator.or_, periodic_filter), reduce(operator.or_, periodic_filter),
periodic_day=self.sending_date.isoweekday(), periodic_day=self.sending_date.isoweekday(),
from_users=False) dailymailing=True,
)
return qs return qs

@ -84,7 +84,7 @@
<table> <table>
<tr> <tr>
<td valign="top" style="width: 225px;"> <td valign="top" style="width: 225px;">
<a href="http://{{ domain }}{{ obj.get_permanent_url }}"><img src="cid:recommended{{ recommended.object.pk }}"/></a> <a href="http://{{ domain }}{{ obj.get_permanent_url }}"><img src="cid:recommended{{ obj.pk }}"/></a>
{% comment %} {% comment %}
{% thumbnail obj.get_logo '281x225' as im %} {% thumbnail obj.get_logo '281x225' as im %}
<img src="{{ im.url }}"/> <img src="{{ im.url }}"/>

@ -85,7 +85,7 @@
<tr> <tr>
<td valign="top" style="width: 225px;"> <td valign="top" style="width: 225px;">
{% thumbnail obj.get_logo '281x225' as im %} {% thumbnail obj.get_logo '281x225' as im %}
<img src="{{ im.url }}"/> <a href="http://{{ domain }}{{ obj.get_permanent_url }}"><img src="{{ im.url }}"/></a>
{% endthumbnail %} {% endthumbnail %}
</td> </td>
@ -99,7 +99,7 @@
</tr> </tr>
<tr> <tr>
<td style="color: #333333; font-size: 25px; font-weight: bold; padding: 3px 0px 3px 0px;">{{ obj.name|safe }}</td> <td style="color: #333333; font-size: 25px; font-weight: bold; padding: 3px 0px 3px 0px;"><a href="http://{{ domain }}{{ obj.get_permanent_url }}">{{ obj.name|safe }}</a></td>
</tr> </tr>
<tr> <tr>
@ -154,13 +154,13 @@
<tr {% if not forloop.last %}style="border-bottom: 1px solid #eaeaea;"{% endif %}> <tr {% if not forloop.last %}style="border-bottom: 1px solid #eaeaea;"{% endif %}>
<td valign="top" style="width: 110px;"> <td valign="top" style="width: 110px;">
{% thumbnail obj.get_logo '109x114' as im %} {% thumbnail obj.get_logo '109x114' as im %}
<img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/> <a href="http://{{ domain }}{{ obj.get_permanent_url }}"><img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/></a>
{% endthumbnail %} {% endthumbnail %}
</td> </td>
<td style="padding-left: 20px;"> <td style="padding-left: 20px;">
<table style="width: 100%;"> <table style="width: 100%;">
<tr> <tr>
<td style="color: #333333; text-transform: uppercase; font-size: 17px; font-weight: bold; padding-bottom: 5px;">{{ obj.name|safe }}</td> <td style="color: #333333; text-transform: uppercase; font-size: 17px; font-weight: bold; padding-bottom: 5px;"><a href="http://{{ domain }}{{ obj.get_permanent_url }}">{{ obj.name|safe }}</a></td>
</tr> </tr>
<tr> <tr>
@ -224,7 +224,7 @@
<tr {% if not forloop.last %}style="border-bottom: 1px solid #eaeaea;"{% endif %}> <tr {% if not forloop.last %}style="border-bottom: 1px solid #eaeaea;"{% endif %}>
<td valign="top"> <td valign="top">
{% thumbnail obj.get_logo '109x114' as im %} {% thumbnail obj.get_logo '109x114' as im %}
<img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/> <a href="http://{{ domain }}{{ obj.get_permanent_url }}"><img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/></a>
{% endthumbnail %} {% endthumbnail %}
</td> </td>
<td style="padding-left: 20px;"> <td style="padding-left: 20px;">
@ -239,7 +239,7 @@
</tr> </tr>
<tr> <tr>
<td style="color: #333333; text-transform: uppercase; font-size: 17px; font-weight: bold; padding-bottom: 5px;">{{ obj.name|safe }}</td> <td style="color: #333333; text-transform: uppercase; font-size: 17px; font-weight: bold; padding-bottom: 5px;"><a href="http://{{ domain }}{{ obj.get_permanent_url }}">{{ obj.name|safe }}</a></td>
</tr> </tr>
<tr> <tr>
@ -297,7 +297,7 @@
<tr> <tr>
<td style="padding-bottom: 15px;"> <td style="padding-bottom: 15px;">
{% thumbnail obj.get_logo '109x114' as im %} {% thumbnail obj.get_logo '109x114' as im %}
<img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/> <a href="http://{{ domain }}{{ obj.get_permanent_url }}"><img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/></a>
{% endthumbnail %} {% endthumbnail %}
</td> </td>
</tr> </tr>
@ -310,7 +310,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="font-family: Arial, sans-serif; color: #333333; font-size: 17px; font-weight: bold; padding-bottom: 10px;">{{ obj.name|safe }}</td> <td style="font-family: Arial, sans-serif; color: #333333; font-size: 17px; font-weight: bold; padding-bottom: 10px;"><a href="http://{{ domain }}{{ obj.get_permanent_url }}">{{ obj.name|safe }}</a></td>
</tr> </tr>
<tr> <tr>
<td style="color: #3399cc; font-size: 12px; padding-bottom: 5px;"> <td style="color: #3399cc; font-size: 12px; padding-bottom: 5px;">
@ -388,15 +388,15 @@
<tr> <tr>
<td style="width: 300px; text-align: center; padding-bottom: 30px;"> <td style="width: 300px; text-align: center; padding-bottom: 30px;">
{% thumbnail news.logo "272x195" as im %} {% thumbnail news.logo "272x195" as im %}
<img src="{{ im.url }}" alt=""> <a href="http://{{ domain }}{{ news.get_permanent_url }}"><img src="{{ im.url }}" alt=""></a>
{% endthumbnail %} {% endthumbnail %}
<img src="{% static 'newsletter/images/news2.jpg' %}" alt=""> {# <img src="{% static 'newsletter/images/news2.jpg' %}" alt="">#}
</td> </td>
<td valign="top"> <td valign="top">
<table> <table>
<tr> <tr>
<td style="padding-bottom: 8px; font-family: Arial, sans-serif; font-size: 17px; font-weight: bold; text-transform: uppercase; color: #333333;">{{ news.main_title|safe }}</td> <td style="padding-bottom: 8px; font-family: Arial, sans-serif; font-size: 17px; font-weight: bold; text-transform: uppercase; color: #333333;"><a href="http://{{ domain }}{{ news.get_permanent_url }}">{{ news.main_title|safe }}</a></td>
</tr> </tr>
<tr> <tr>
<td valign="middle" style="color: #3399cc; font-size: 13px; padding-bottom: 8px;"> <td valign="middle" style="color: #3399cc; font-size: 13px; padding-bottom: 8px;">
@ -436,7 +436,7 @@
<tr> <tr>
<td style="width: 300px; text-align: center; padding-bottom: 40px;"> <td style="width: 300px; text-align: center; padding-bottom: 40px;">
{% thumbnail blog.logo "272x195" as im %} {% thumbnail blog.logo "272x195" as im %}
<img src="{{ im.url }}" alt=""> <a href="http://{{ domain }}{{ blog.get_permanent_url }}"><img src="{{ im.url }}" alt=""></a>
{% endthumbnail %} {% endthumbnail %}
</td> </td>

@ -1,11 +1,17 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf.urls import include, patterns, url from django.conf.urls import include, patterns, url
from .views import FilterListView, SubscribeView from .views import FilterListView, SubscribeView, event_visit
urlpatterns = patterns('', events_urlpatterns = patterns('',
url(r'^$', FilterListView.as_view(), name='main'), url(r'^$', FilterListView.as_view(), name='main'),
url(r'^results/$', FilterListView.as_view(), {'with_form': False}, name='results'), url(r'^results/$', FilterListView.as_view(), {'with_form': False}, name='results'),
url(r'^form/$', FilterListView.as_view(), {'with_results': False}, name='form'), url(r'^form/$', FilterListView.as_view(), {'with_results': False}, name='form'),
url(r'^subscribe/(?P<model>(conf|expo))/(?P<slug>[^/]*)/$', SubscribeView.as_view(), name='subscribe'), url(r'^subscribe/(?P<model>(conf|expo))/(?P<slug>[^/]*)/$', SubscribeView.as_view(), name='subscribe'),
)
urlpatterns = (
url(r'^events/', include(events_urlpatterns)),
url(r'^(?P<event_type>(exposition|conference))-visit/(?P<id>\d+)/$', event_visit),
) )

@ -164,3 +164,23 @@ class SubscribeView(FormView):
self.contact = self.get_contact() self.contact = self.get_contact()
return self.success_responce() return self.success_responce()
return super(SubscribeView, self).post(request, *args, **kwargs) return super(SubscribeView, self).post(request, *args, **kwargs)
def event_visit(request, event_type, id):
args = {'success': False}
user = request.user
model = {'exposition': Exposition, 'conference': Conference}.get(event_type)
if user.is_authenticated():
event = model.objects.safe_get(id=id)
if user in event.users.all():
event.users.remove(user)
args['in'] = False
else:
event.users.add(user)
args['in'] = True
args['success'] = True
else:
args['not_authorized'] = True
args['success'] = True
return JsonResponse(args)

@ -164,7 +164,7 @@ class Banner(models.Model, StatMixin):
'group': self.group, 'group': self.group,
'ip': request.META.get('REMOTE_ADDR'), 'ip': request.META.get('REMOTE_ADDR'),
'user_agent': request.META.get('HTTP_USER_AGENT'), 'user_agent': request.META.get('HTTP_USER_AGENT'),
'page': request.META.get('HTTP_REFERER'), 'page': request.META.get('HTTP_REFERER', '')[:255],
} }
if request.user.is_authenticated(): if request.user.is_authenticated():
@ -217,7 +217,7 @@ class Log(models.Model):
datetime = models.DateTimeField(verbose_name=_('Clicked At'), auto_now_add=True) datetime = models.DateTimeField(verbose_name=_('Clicked At'), auto_now_add=True)
ip = models.IPAddressField(verbose_name=_('IP'), null=True, blank=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) user_agent = models.CharField(verbose_name=_('User Agent'), max_length=1024, null=True, blank=True)
page = models.URLField(verbose_name=_('Page'), null=True, blank=True) 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) key = models.CharField(verbose_name=_('User Agent'), max_length=32, null=True, blank=True)
TYPE_CHOICES = ( TYPE_CHOICES = (
(0, 'impressions'), (0, 'impressions'),

@ -26,7 +26,7 @@ from .views import (
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^expo/add-note/(?P<slug>.*)/$', 'exposition.views.add_note'), url(r'^expo/add-note/(?P<slug>.*)/$', 'exposition.views.add_note'),
url(r'^exposition-add-calendar/(?P<id>\d+)/$', 'exposition.views.exposition_add_calendar'), url(r'^exposition-add-calendar/(?P<id>\d+)/$', 'exposition.views.exposition_add_calendar'),
url(r'^exposition-visit/(?P<id>\d+)/$', 'exposition.views.exposition_visit'), # url(r'^exposition-visit/(?P<id>\d+)/$', 'exposition.views.exposition_visit'),
# search # search
url(r'^expo/search/', ExpositionSearchView.as_view()), url(r'^expo/search/', ExpositionSearchView.as_view()),

@ -158,25 +158,25 @@ def exposition_add_calendar(request, id):
return HttpResponse(json.dumps(args), content_type='application/json') return HttpResponse(json.dumps(args), content_type='application/json')
# перенесено в events
def exposition_visit(request, id): # def exposition_visit(request, id):
args = {'success': False} # args = {'success': False}
user = request.user # user = request.user
if user.is_authenticated(): # if user.is_authenticated():
exp = Exposition.objects.safe_get(id=id) # exp = Exposition.objects.safe_get(id=id)
if user in exp.users.all(): # if user in exp.users.all():
exp.users.remove(user) # exp.users.remove(user)
args['in'] = False # args['in'] = False
else: # else:
exp.users.add(user) # exp.users.add(user)
args['in'] = True # args['in'] = True
#
args['success'] = True # args['success'] = True
else: # else:
args['not_authorized'] = True # args['not_authorized'] = True
args['success'] = True # args['success'] = True
#
return HttpResponse(json.dumps(args), content_type='application/json') # return HttpResponse(json.dumps(args), content_type='application/json')
class ExpoDetail(ObjectStatMixin, JitterCacheMixin, MetadataMixin, DetailView): class ExpoDetail(ObjectStatMixin, JitterCacheMixin, MetadataMixin, DetailView):

@ -80,7 +80,7 @@ urlpatterns += solid_i18n_patterns('',
#url(r'^translators/', include('translator.urls')), #url(r'^translators/', include('translator.urls')),
url(r'^translators/', include('specialist_catalog.urls')), url(r'^translators/', include('specialist_catalog.urls')),
url(r'^newsletters/', include('emencia.django.newsletter.urls')), url(r'^newsletters/', include('emencia.django.newsletter.urls')),
url(r'^events/', include('events.urls', namespace='events')), url(r'^', include('events.urls', namespace='events')),
url(r'^', include('accounts.urls')), url(r'^', include('accounts.urls')),
url(r'^', include('exposition.urls')), url(r'^', include('exposition.urls')),
url(r'^', include('settings.conference_old_urls')), # conference redirects from old version url(r'^', include('settings.conference_old_urls')), # conference redirects from old version

@ -136,7 +136,7 @@
{% endthumbnail %} {% endthumbnail %}
<a href="{{ sim.get_permanent_url }}">{{ sim.main_title }}</a> <a href="{{ sim.get_permanent_url }}">{{ sim.main_title }}</a>
<time><i class="fa fa-calendar"></i> {{ sim.publish_date|date:"d E Y" }}</time> <time><i class="fa fa-calendar"></i> {{ sim.publish_date|date:"d E Y" }}</time>
<p>{{ sim.preview }}</p> <p>{{ sim.preview|safe }}</p>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
@ -181,27 +181,27 @@
</div> </div>
</div> </div>
{% with blogs=object.similars %} {# {% with blogs=object.similars %}#}
{% if blogs %} {# {% if blogs %}#}
<div class="rq-to-hide"> {# <div class="rq-to-hide">#}
<div class="s-comments"> {# <div class="s-comments">#}
<div class="sect-title blog_link">{% trans 'Похожие статьи' %}<a class="button more" href="/blogs/">{% trans 'Все статьи' %}</a></div> {# <div class="sect-title blog_link">{% trans 'Похожие статьи' %}<a class="button more" href="/blogs/">{% trans 'Все статьи' %}</a></div>#}
<div class="cat-list sc-comments"> {# <div class="cat-list sc-comments">#}
{% for blog in blogs %} {# {% for blog in blogs %}#}
<div class="cl-item"> {# <div class="cl-item">#}
<div class="acticle_list"> {# <div class="acticle_list">#}
<a href="{{ blog.get_permanent_url }}" title="">{% include 'includes/show_logo.html' with obj=blog %}</a> {# <a href="{{ blog.get_permanent_url }}" title="">{% include 'includes/show_logo.html' with obj=blog %}</a>#}
<h3><a href="{{ blog.get_permanent_url }}" title="">{{ blog.main_title }}</a></h3> {# <h3><a href="{{ blog.get_permanent_url }}" title="">{{ blog.main_title }}</a></h3>#}
<p>{{ blog.preview }}</p> {# <p>{{ blog.preview|safe }}</p>#}
<strong><span>{{ blog.publish_date|date:"d E Y" }}</span><a href="{{ blog.author.get_permanent_url }}" title=""><i>{% trans "Евгения Булавина" %}</i></a></strong> {# <strong><span>{{ blog.publish_date|date:"d E Y" }}</span><a href="{{ blog.author.get_permanent_url }}" title=""><i>{% trans "Евгения Булавина" %}</i></a></strong>#}
</div> {# </div>#}
</div> {# </div>#}
{% endfor %} {# {% endfor %}#}
</div> {# </div>#}
</div> {# </div>#}
</div> {# </div>#}
{% endif %} {# {% endif %}#}
{% endwith %} {# {% endwith %}#}
{% endblock %} {% endblock %}

@ -3,13 +3,13 @@
{% if user.is_authenticated %} {% if user.is_authenticated %}
{% if user in event.users.all %} {% if user in event.users.all %}
<a style="display:none;" class="button icon-check visit" href="{{ exposition.get_visit_url }}">{% trans 'Я планирую посетить' %}</a> <a style="display:none;" class="button icon-check visit" href="{{ event.get_visit_url }}">{% trans 'Я планирую посетить' %}</a>
<a class="button icon-check unvisit" href="{{ exposition.get_visit_url }}">{% trans 'Не планирую посещать' %}</a> <a class="button icon-check unvisit" href="{{ event.get_visit_url }}">{% trans 'Не планирую посещать' %}</a>
{% else %} {% else %}
<a class="button icon-check visit" href="{{ exposition.get_visit_url }}">{% trans 'Я планирую посетить' %}</a> <a class="button icon-check visit" href="{{ event.get_visit_url }}">{% trans 'Я планирую посетить' %}</a>
<a style="display:none;" class="button icon-check unvisit" href="{{ exposition.get_visit_url }}">{% trans 'Не планирую посещать' %}</a> <a style="display:none;" class="button icon-check unvisit" href="{{ event.get_visit_url }}">{% trans 'Не планирую посещать' %}</a>
{% endif %} {% endif %}
{% else %} {% else %}
<a class="button icon-check visit" href="{{ exposition.get_visit_url }}">{% trans 'Я планирую посетить' %}</a> <a class="button icon-check visit" href="{{ event.get_visit_url }}">{% trans 'Я планирую посетить' %}</a>
<a style="display:none;" class="button icon-check unvisit" href="{{ exposition.get_visit_url }}">{% trans 'Не планирую посещать' %}</a> <a style="display:none;" class="button icon-check unvisit" href="{{ event.get_visit_url }}">{% trans 'Не планирую посещать' %}</a>
{% endif %} {% endif %}

Loading…
Cancel
Save