diff --git a/conference/urls.py b/conference/urls.py index f7e4729e..e1c28e97 100644 --- a/conference/urls.py +++ b/conference/urls.py @@ -25,7 +25,7 @@ urlpatterns = patterns('', url(r'^conference/add-note/(?P[^/]*)/$', 'conference.views.add_note'), url(r'^conference-add-calendar/(?P\d+)/$', 'conference.views.conference_add_calendar'), - url(r'^conference-visit/(?P\d+)/$', 'conference.views.conference_visit'), + # url(r'^conference-visit/(?P\d+)/$', 'conference.views.conference_visit'), # search url(r'^conference/search/', ExpositionSearchView.as_view()), # country catalog diff --git a/conference/views.py b/conference/views.py index fefa2e84..91b8b0a8 100644 --- a/conference/views.py +++ b/conference/views.py @@ -557,25 +557,26 @@ def conference_add_calendar(request, id): 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): args = {'success': False} diff --git a/emencia/django/newsletter/forms.py b/emencia/django/newsletter/forms.py index 71ca7b09..41d58d9e 100644 --- a/emencia/django/newsletter/forms.py +++ b/emencia/django/newsletter/forms.py @@ -165,9 +165,10 @@ class MailingSettingsForm(forms.ModelForm): obj.area = areas 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) - 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.tags = self.cleaned_data.get('tg') or [] diff --git a/emencia/django/newsletter/models.py b/emencia/django/newsletter/models.py index c977a591..f2224049 100644 --- a/emencia/django/newsletter/models.py +++ b/emencia/django/newsletter/models.py @@ -151,7 +151,7 @@ class Contact(models.Model): ) activated = 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) russia = models.BooleanField(_(u'Россия'), blank=True, default=True) @@ -713,7 +713,8 @@ class Newsletter(models.Model): qs = Contact.objects.subscribers().filter( reduce(operator.or_, periodic_filter), periodic_day=self.sending_date.isoweekday(), - from_users=False) + dailymailing=True, + ) return qs diff --git a/emencia/django/newsletter/templates/newsletter/AutomaticEmail.html b/emencia/django/newsletter/templates/newsletter/AutomaticEmail.html index a932e75e..89f050d6 100644 --- a/emencia/django/newsletter/templates/newsletter/AutomaticEmail.html +++ b/emencia/django/newsletter/templates/newsletter/AutomaticEmail.html @@ -84,7 +84,7 @@ @@ -99,7 +99,7 @@ - + @@ -154,13 +154,13 @@
- + {% comment %} {% thumbnail obj.get_logo '281x225' as im %} diff --git a/emencia/django/newsletter/templates/newsletter/AutomaticEmail_web.html b/emencia/django/newsletter/templates/newsletter/AutomaticEmail_web.html index 6b1227ed..5be5e9a9 100644 --- a/emencia/django/newsletter/templates/newsletter/AutomaticEmail_web.html +++ b/emencia/django/newsletter/templates/newsletter/AutomaticEmail_web.html @@ -85,7 +85,7 @@
{% thumbnail obj.get_logo '281x225' as im %} - + {% endthumbnail %}
{{ obj.name|safe }}{{ obj.name|safe }}
{% thumbnail obj.get_logo '109x114' as im %} - + {% endthumbnail %} - + @@ -224,7 +224,7 @@ - + @@ -297,7 +297,7 @@ @@ -310,7 +310,7 @@ - +
{{ obj.name|safe }}{{ obj.name|safe }}
{% thumbnail obj.get_logo '109x114' as im %} - + {% endthumbnail %} @@ -239,7 +239,7 @@
{{ obj.name|safe }}{{ obj.name|safe }}
{% thumbnail obj.get_logo '109x114' as im %} - + {% endthumbnail %}
{{ obj.name|safe }}{{ obj.name|safe }}
@@ -388,15 +388,15 @@
{% thumbnail news.logo "272x195" as im %} - + {% endthumbnail %} - +{# #} - + diff --git a/events/urls.py b/events/urls.py index 88d35ae9..48d0f620 100644 --- a/events/urls.py +++ b/events/urls.py @@ -1,11 +1,17 @@ # -*- coding: utf-8 -*- 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'^results/$', FilterListView.as_view(), {'with_form': False}, name='results'), url(r'^form/$', FilterListView.as_view(), {'with_results': False}, name='form'), url(r'^subscribe/(?P(conf|expo))/(?P[^/]*)/$', SubscribeView.as_view(), name='subscribe'), + ) + +urlpatterns = ( + url(r'^events/', include(events_urlpatterns)), + url(r'^(?P(exposition|conference))-visit/(?P\d+)/$', event_visit), +) \ No newline at end of file diff --git a/events/views.py b/events/views.py index 6331ade0..094c1272 100644 --- a/events/views.py +++ b/events/views.py @@ -164,3 +164,23 @@ class SubscribeView(FormView): self.contact = self.get_contact() return self.success_responce() 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) \ No newline at end of file diff --git a/expobanner/models.py b/expobanner/models.py index 895bed19..8e2a677d 100644 --- a/expobanner/models.py +++ b/expobanner/models.py @@ -164,7 +164,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'), + 'page': request.META.get('HTTP_REFERER', '')[:255], } if request.user.is_authenticated(): @@ -217,7 +217,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) - 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) TYPE_CHOICES = ( (0, 'impressions'), diff --git a/exposition/urls.py b/exposition/urls.py index f5df260e..85d3516b 100644 --- a/exposition/urls.py +++ b/exposition/urls.py @@ -26,7 +26,7 @@ from .views import ( urlpatterns = patterns('', url(r'^expo/add-note/(?P.*)/$', 'exposition.views.add_note'), url(r'^exposition-add-calendar/(?P\d+)/$', 'exposition.views.exposition_add_calendar'), - url(r'^exposition-visit/(?P\d+)/$', 'exposition.views.exposition_visit'), + # url(r'^exposition-visit/(?P\d+)/$', 'exposition.views.exposition_visit'), # search url(r'^expo/search/', ExpositionSearchView.as_view()), diff --git a/exposition/views.py b/exposition/views.py index e775f48f..ce81b82e 100644 --- a/exposition/views.py +++ b/exposition/views.py @@ -158,25 +158,25 @@ def exposition_add_calendar(request, id): return HttpResponse(json.dumps(args), content_type='application/json') - -def exposition_visit(request, id): - args = {'success': False} - user = request.user - if user.is_authenticated(): - exp = Exposition.objects.safe_get(id=id) - if user in exp.users.all(): - exp.users.remove(user) - args['in'] = False - else: - exp.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') +# перенесено в events +# def exposition_visit(request, id): +# args = {'success': False} +# user = request.user +# if user.is_authenticated(): +# exp = Exposition.objects.safe_get(id=id) +# if user in exp.users.all(): +# exp.users.remove(user) +# args['in'] = False +# else: +# exp.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') class ExpoDetail(ObjectStatMixin, JitterCacheMixin, MetadataMixin, DetailView): diff --git a/proj/urls.py b/proj/urls.py index 550046e2..8eecc716 100644 --- a/proj/urls.py +++ b/proj/urls.py @@ -80,7 +80,7 @@ urlpatterns += solid_i18n_patterns('', #url(r'^translators/', include('translator.urls')), url(r'^translators/', include('specialist_catalog.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('exposition.urls')), url(r'^', include('settings.conference_old_urls')), # conference redirects from old version diff --git a/templates/client/article/article.html b/templates/client/article/article.html index 90b9b1db..7f5fcd68 100644 --- a/templates/client/article/article.html +++ b/templates/client/article/article.html @@ -136,7 +136,7 @@ {% endthumbnail %} {{ sim.main_title }} -

{{ sim.preview }}

+

{{ sim.preview|safe }}

{% endfor %} @@ -181,27 +181,27 @@ - {% with blogs=object.similars %} - {% if blogs %} -
-
- -
- {% for blog in blogs %} - - {% endfor %} -
-
-
- {% endif %} - {% endwith %} +{# {% with blogs=object.similars %}#} +{# {% if blogs %}#} +{#
#} +{#
#} +{# #} +{#
#} +{# {% for blog in blogs %}#} +{#
#} +{#
#} +{# {% include 'includes/show_logo.html' with obj=blog %}#} +{#

{{ blog.main_title }}

#} +{#

{{ blog.preview|safe }}

#} +{# {{ blog.publish_date|date:"d E Y" }}{% trans "Евгения Булавина" %}#} +{#
#} +{#
#} +{# {% endfor %}#} +{#
#} +{#
#} +{#
#} +{# {% endif %}#} +{# {% endwith %}#} {% endblock %} diff --git a/templates/client/includes/visit_button.html b/templates/client/includes/visit_button.html index da17220c..23cdac16 100644 --- a/templates/client/includes/visit_button.html +++ b/templates/client/includes/visit_button.html @@ -3,13 +3,13 @@ {% if user.is_authenticated %} {% if user in event.users.all %} - - {% trans 'Не планирую посещать' %} + + {% trans 'Не планирую посещать' %} {% else %} - {% trans 'Я планирую посетить' %} - + {% trans 'Я планирую посетить' %} + {% endif %} {% else %} - {% trans 'Я планирую посетить' %} - + {% trans 'Я планирую посетить' %} + {% endif %}
{{ news.main_title|safe }}{{ news.main_title|safe }}
@@ -436,7 +436,7 @@
{% thumbnail blog.logo "272x195" as im %} - + {% endthumbnail %}