изменения по закрытию 6 этапа

remotes/origin/stage6
Alexander Burdeinyi 9 years ago
parent 42ed23a47a
commit 40fb2e1952
  1. 4
      conference/admin.py
  2. 2
      conference/models.py
  3. 10
      conference/views.py
  4. 18
      emencia/django/newsletter/forms.py
  5. 32
      emencia/django/newsletter/migrations/0016_auto__add_field_contact_from_events.py
  6. 2
      emencia/django/newsletter/models.py
  7. 34
      events/views.py
  8. 4
      exposition/admin.py
  9. 11
      static/client/js/_modules/page.exposition.object.js
  10. 87
      templates/c_admin/newsletters/contact_list.html
  11. 3
      templates/client/popups/event_news_subscribe.html

@ -351,12 +351,12 @@ def upload_conference_photo(request, conf_id):
def search_conf(request): def search_conf(request):
term = request.GET['term'].capitalize() term = request.GET.get('term')
lang = translation.get_language() lang = translation.get_language()
if not term: if not term:
qs = SearchQuerySet().models(Conference).order_by('text')[:30] qs = SearchQuerySet().models(Conference).order_by('text')[:30]
else: else:
qs = SearchQuerySet().models(Conference).autocomplete(content_auto=term).order_by('text')[:30] qs = SearchQuerySet().models(Conference).autocomplete(content_auto=term.capitalize()).order_by('text')[:30]
result = [] result = []
for item in qs: for item in qs:

@ -149,6 +149,8 @@ class Conference(TranslatableModel, EventMixin, ExpoMixin):
_(u'Минимальная цена'), choices=PRICE_EUR, blank=True, null=True, db_index=True) _(u'Минимальная цена'), choices=PRICE_EUR, blank=True, null=True, db_index=True)
price_eur = models.PositiveIntegerField(verbose_name=_(u'Цена в евро'), blank=True, null=True) price_eur = models.PositiveIntegerField(verbose_name=_(u'Цена в евро'), blank=True, null=True)
comments = generic.GenericRelation('comments.Comment')
def __unicode__(self): def __unicode__(self):
return self.lazy_translation_getter('name', unicode(self.pk)) return self.lazy_translation_getter('name', unicode(self.pk))

@ -451,11 +451,11 @@ class ConferenceDetail(ObjectStatMixin, CommentMixin, JitterCacheMixin, Metadata
if city: if city:
return HttpResponseRedirect('/conference/city/%s/'%city.url) return HttpResponseRedirect('/conference/city/%s/'%city.url)
except Exception: except Exception:
try: # try:
return super(ConferenceDetail, self).dispatch(request, *args, **kwargs) return super(ConferenceDetail, self).dispatch(request, *args, **kwargs)
except: # except Ex:
raise Http404('NotFound') # raise Http404('NotFound')
#
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
lang = translation.get_language() lang = translation.get_language()
context = super(ConferenceDetail, self).get_context_data(**kwargs) context = super(ConferenceDetail, self).get_context_data(**kwargs)

@ -6,12 +6,15 @@ import xlrd
from django import forms from django import forms
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db.models import Sum from django.db.models import Sum, Q
from django.http import Http404 from django.http import Http404
from django.utils import translation from django.utils import translation
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import get_language from django.utils.translation import get_language
from django.utils.encoding import smart_text, force_text from django.utils.encoding import smart_text, force_text
from conference.models import Conference
from exposition.models import Exposition
from functions.forms import ML_ModelMultipleChoiceField from functions.forms import ML_ModelMultipleChoiceField
from haystack.query import SearchQuerySet from haystack.query import SearchQuerySet
@ -252,6 +255,10 @@ class ContactFilterForm(forms.Form):
label="Area", choices=[(c.id, c.name) for c in list(set(Area.objects.language()))], label="Area", choices=[(c.id, c.name) for c in list(set(Area.objects.language()))],
required=False required=False
) )
exposition = ML_ModelMultipleChoiceField(label=_(u'Новости по выставкам'), queryset=Exposition.objects.all(), required=False)
conference = ML_ModelMultipleChoiceField(label=_(u'Новости по конференциям'), queryset=Conference.objects.all(), required=False)
event_news = forms.BooleanField(label=_(u'Подписка на новости хотя бы по 1 событию'), required=False)
mailinglist = forms.ModelChoiceField( mailinglist = forms.ModelChoiceField(
queryset=MailingList.objects.all(), queryset=MailingList.objects.all(),
label="Список рассылки", label="Список рассылки",
@ -304,6 +311,15 @@ class ContactFilterForm(forms.Form):
qs = qs.filter(subscriber=False) qs = qs.filter(subscriber=False)
else: else:
qs = qs.filter(subscriber=True) qs = qs.filter(subscriber=True)
if self.cleaned_data.get('event_news'):
qs = qs.filter(Q(conferences__isnull=False) | Q(expositions__isnull=False))
else:
q = Q()
if self.cleaned_data.get('conference'):
q = Q(conferences__in=self.cleaned_data.get('conference'))
if self.cleaned_data.get('expositions'):
q |= Q(conferences__in=self.cleaned_data.get('expositions'))
qs = qs.filter(q)
types = self.cleaned_data.get('types_choice') types = self.cleaned_data.get('types_choice')
if types == types_choice.USERS: if types == types_choice.USERS:

@ -8,9 +8,9 @@ from django.db import models
class Migration(SchemaMigration): class Migration(SchemaMigration):
def forwards(self, orm): def forwards(self, orm):
# Adding field 'Contact.events_news' # Adding field 'Contact.dailymailing'
db.add_column(u'newsletter_contact', 'events_news', db.add_column(u'newsletter_contact', 'dailymailing',
self.gf('django.db.models.fields.BooleanField')(default=False), self.gf('django.db.models.fields.BooleanField')(default=True),
keep_default=False) keep_default=False)
# Adding M2M table for field conferences on 'Contact' # Adding M2M table for field conferences on 'Contact'
@ -33,8 +33,8 @@ class Migration(SchemaMigration):
def backwards(self, orm): def backwards(self, orm):
# Deleting field 'Contact.events_news' # Deleting field 'Contact.dailymailing'
db.delete_column(u'newsletter_contact', 'events_news') db.delete_column(u'newsletter_contact', 'dailymailing')
# Removing M2M table for field conferences on 'Contact' # Removing M2M table for field conferences on 'Contact'
db.delete_table(db.shorten_name(u'newsletter_contact_conferences')) db.delete_table(db.shorten_name(u'newsletter_contact_conferences'))
@ -98,6 +98,18 @@ class Migration(SchemaMigration):
'services': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}), 'services': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}),
'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}) 'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'})
}, },
u'comments.comment': {
'Meta': {'object_name': 'Comment'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['comments.Comment']", 'null': 'True', 'blank': 'True'}),
'text': ('django.db.models.fields.TextField', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['accounts.User']"})
},
u'company.company': { u'company.company': {
'Meta': {'ordering': "['-rating', 'id']", 'unique_together': '()', 'object_name': 'Company', 'index_together': '()'}, 'Meta': {'ordering': "['-rating', 'id']", 'unique_together': '()', 'object_name': 'Company', 'index_together': '()'},
'address': ('functions.custom_fields.LocationField', [], {'blank': 'True'}), 'address': ('functions.custom_fields.LocationField', [], {'blank': 'True'}),
@ -256,7 +268,7 @@ class Migration(SchemaMigration):
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'customer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['expobanner.Customer']", 'null': 'True', 'blank': 'True'}), 'customer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['expobanner.Customer']", 'null': 'True', 'blank': 'True'}),
'flash': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'flash': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'fr': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2016, 11, 22, 0, 0)'}), 'fr': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2016, 11, 23, 0, 0)'}),
'group': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'banners'", 'null': 'True', 'to': u"orm['expobanner.BannerGroup']"}), 'group': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'banners'", 'null': 'True', 'to': u"orm['expobanner.BannerGroup']"}),
'html': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'html': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
@ -329,7 +341,7 @@ class Migration(SchemaMigration):
'country': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['country.Country']", 'null': 'True', 'blank': 'True'}), 'country': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['country.Country']", 'null': 'True', 'blank': 'True'}),
'excluded_cities': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['city.City']", 'null': 'True', 'blank': 'True'}), 'excluded_cities': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['city.City']", 'null': 'True', 'blank': 'True'}),
'excluded_tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['theme.Tag']", 'null': 'True', 'blank': 'True'}), 'excluded_tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['theme.Tag']", 'null': 'True', 'blank': 'True'}),
'fr': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2016, 11, 22, 0, 0)'}), 'fr': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2016, 11, 23, 0, 0)'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'link': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['expobanner.Banner']"}), 'link': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['expobanner.Banner']"}),
'months': ('functions.custom_fields.MonthMultiSelectField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}), 'months': ('functions.custom_fields.MonthMultiSelectField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}),
@ -438,7 +450,7 @@ class Migration(SchemaMigration):
u'newsletter.contact': { u'newsletter.contact': {
'Meta': {'ordering': "('-modification_date',)", 'object_name': 'Contact'}, 'Meta': {'ordering': "('-modification_date',)", 'object_name': 'Contact'},
'activated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'activated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'activation_code': ('django.db.models.fields.CharField', [], {'default': "'f0ee2280ab463a4d1e0c68acfbe98b44115b34a2'", 'max_length': '40'}), 'activation_code': ('django.db.models.fields.CharField', [], {'default': "'a1d2fb1379a544e39c9d2ff60f931eef3bf850de'", 'max_length': '40'}),
'area': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['country.Area']", 'null': 'True', 'blank': 'True'}), 'area': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['country.Area']", 'null': 'True', 'blank': 'True'}),
'conferences': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['conference.Conference']", 'null': 'True', 'symmetrical': 'False'}), 'conferences': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['conference.Conference']", 'null': 'True', 'symmetrical': 'False'}),
'content_articles': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'content_articles': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
@ -446,8 +458,8 @@ class Migration(SchemaMigration):
'content_overview': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'content_overview': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']", 'null': 'True', 'blank': 'True'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']", 'null': 'True', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'dailymailing': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '255'}), 'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '255'}),
'events_news': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'expositions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['exposition.Exposition']", 'null': 'True', 'symmetrical': 'False'}), 'expositions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['exposition.Exposition']", 'null': 'True', 'symmetrical': 'False'}),
'f_countries': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['country.Country']", 'null': 'True', 'blank': 'True'}), 'f_countries': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['country.Country']", 'null': 'True', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
@ -543,7 +555,7 @@ class Migration(SchemaMigration):
'conference': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['conference.Conference']", 'null': 'True'}), 'conference': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['conference.Conference']", 'null': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'exposition': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['exposition.Exposition']", 'null': 'True'}), 'exposition': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['exposition.Exposition']", 'null': 'True'}),
'fr': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2016, 11, 22, 0, 0)'}), 'fr': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2016, 11, 23, 0, 0)'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'theme': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['theme.Theme']", 'null': 'True', 'symmetrical': 'False'}), 'theme': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['theme.Theme']", 'null': 'True', 'symmetrical': 'False'}),
'to': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) 'to': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'})

@ -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)
events_news = models.BooleanField(default=False) dailymailing = models.BooleanField(default=True)
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)

@ -1,9 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse, reverse_lazy
from django.db.models import Q from django.db.models import Q
from django.http import Http404 from django.http import Http404
from django.http import HttpResponseForbidden from django.http import HttpResponseForbidden
from django.http import HttpResponseNotFound from django.http import HttpResponseNotFound
from django.http import HttpResponsePermanentRedirect
from django.views.generic.edit import FormMixin, FormView from django.views.generic.edit import FormMixin, FormView
from django.conf import settings from django.conf import settings
from django.template.loader import render_to_string from django.template.loader import render_to_string
@ -91,11 +93,12 @@ class FilterListView(ReverseOrderMixin, FilterListView_):
class SubscribeView(FormView): class SubscribeView(FormView):
form_class = ContactForm form_class = ContactForm
template_name = None template_name = None
redirect_url = reverse_lazy('subscription_activation_send')
models = {'expo': (Exposition, 'expositions'), 'conf': (Conference, 'conferences')} models = {'expo': (Exposition, 'expositions'), 'conf': (Conference, 'conferences')}
defaults = { defaults = {
'activated': True, # 'activated': True,
'from_events': True, # 'from_events': True,
'subscriber': False, 'dailymailing': False,
} }
def get_event(self): def get_event(self):
@ -114,7 +117,6 @@ class SubscribeView(FormView):
'last_name': user.last_name, 'last_name': user.last_name,
'email': user.email, 'email': user.email,
'user': user, 'user': user,
'subscriber': False,
} }
defaults.update(self.defaults) defaults.update(self.defaults)
try: try:
@ -124,6 +126,14 @@ class SubscribeView(FormView):
contact.save() contact.save()
return contact return contact
def get_form_kwargs(self):
"""
Returns the keyword arguments for instantiating the form.
"""
kwargs = super(SubscribeView, self).get_form_kwargs()
kwargs.update({'instance': self.object})
return kwargs
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
if not request.is_ajax(): if not request.is_ajax():
return HttpResponseForbidden() return HttpResponseForbidden()
@ -135,25 +145,19 @@ class SubscribeView(FormView):
return HttpResponseNotFound() return HttpResponseNotFound()
return super(SubscribeView, self).dispatch(request, *args, **kwargs) return super(SubscribeView, self).dispatch(request, *args, **kwargs)
# def get_form(self, form_class):
# form = super(SubscribeView, self).get_form(form_class)
# form.fields['email'].error_messages.update({
# 'unique': _(u'Тест')
# })
# # import pdb; pdb.set_trace()
# return form
def form_invalid(self, form): def form_invalid(self, form):
return JsonResponse({'errors': form.errors}) return JsonResponse({'errors': form.errors})
def form_valid(self, form): def form_valid(self, form):
contact = form.save(commit=False) contact = form.save(commit=False)
contact.dailymailing = False
contact.save()
contact.send_activation() contact.send_activation()
return self.success_responce() return self.success_responce(sent=True)
def success_responce(self): def success_responce(self, sent=False):
self.set_event() self.set_event()
return JsonResponse({'success': True}) return JsonResponse({'success': True, 'sent': sent, 'redirect_url': str(self.redirect_url)})
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
if request.user.is_authenticated(): if request.user.is_authenticated():

@ -360,12 +360,12 @@ def get_by_lang(item, field, lang='en'):
return getattr(item, field+'_'+lang) return getattr(item, field+'_'+lang)
def search_expo(request): def search_expo(request):
term = request.GET['term'].capitalize() term = request.GET.get('term')
lang = translation.get_language() lang = translation.get_language()
if not term: if not term:
qs = SearchQuerySet().models(Exposition).order_by('text')[:30] qs = SearchQuerySet().models(Exposition).order_by('text')[:30]
else: else:
qs = SearchQuerySet().models(Exposition).autocomplete(content_auto=term).order_by('text')[:30] qs = SearchQuerySet().models(Exposition).autocomplete(content_auto=term.capitalize()).order_by('text')[:30]
result = [] result = []
for item in qs: for item in qs:
label = get_by_lang(item, 'name', lang) label = get_by_lang(item, 'name', lang)

@ -178,7 +178,16 @@ if (EXPO.exposition.object){
clearValue(); clearValue();
dataLayer.push({'event': 'event-news-subscribe-form'}); dataLayer.push({'event': 'event-news-subscribe-form'});
$('input:text',$form).val(''); $('input:text',$form).val('');
$.fancybox.close(); $('p#success').show();
if (data.sent == true) {
window.location = data.redirect_url;
} else {
window.setTimeout(function () {
$.fancybox.close();
}, 1000);
}
} }
$waiter.hide(); $waiter.hide();
}; };

@ -63,6 +63,30 @@
</div> </div>
</div> </div>
<!-- Exposition -->
<div class="control-group">
<label class="control-label" for="id_exposition">{{ form.exposition.label }}</label>
<div class="controls">
{{ form.exposition }}
</div>
</div>
<!-- Conference -->
<div class="control-group">
<label class="control-label" for="id_conference">{{ form.conference.label }}</label>
<div class="controls">
{{ form.conference }}
</div>
</div>
<!-- event_news -->
<div class="control-group">
<label class="control-label" for="id_conference">{{ form.event_news.label }}</label>
<div class="controls">
{{ form.event_news }}
</div>
</div>
<!-- Mailing list --> <!-- Mailing list -->
<div class="control-group"> <div class="control-group">
<label class="control-label" for="id_mailinglist">{{ form.mailinglist.label }}</label> <label class="control-label" for="id_mailinglist">{{ form.mailinglist.label }}</label>
@ -185,10 +209,14 @@
{% endblock %} {% endblock %}
{% block select2 %}
<link href="{% static 'js/select2-4.0.3/css/select2.min.css' %}" rel="stylesheet"/>
<script src="{% static 'js/select2-4.0.3/js/select2.full.min.js' %}"></script>
{% endblock select2 %}
{% block scripts %} {% block scripts %}
<script src="{% static 'js/select2.min.js' %}"></script> {# <script src="{% static 'js/select2.min.js' %}"></script>#}
<link href="{% static 'js/select/select2.css' %}" rel='stylesheet'> {# <link href="{% static 'js/select/select2.css' %}" rel='stylesheet'>#}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
@ -231,7 +259,60 @@
var href = $(this).attr('href'); var href = $(this).attr('href');
window.location = href+get_param; window.location = href+get_param;
} }
}) });
$('select#id_conference').select2({
multiple: true,
ajax: {
url: '/admin/conference/search/',
width: '550px',
dataType: "json",
quietMillis: 200,
data: function(params){
return {term: params.term,
page: params.page};
},
processResults: function (data) {
return {results: $.map(data, function(obj) {
{# obj.text = obj.label;#}
return {id: obj.id, text: obj.label}
})};
},
},
createTag: function(params) {
return undefined;
},
});
$('select#id_exposition').select2({
multiple: true,
ajax: {
url: '/admin/exposition/search/',
width: '550px',
dataType: "json",
quietMillis: 200,
data: function(params){
return {term: params.term,
page: params.page};
},
processResults: function (data) {
return {results: $.map(data, function(obj) {
return {id: obj.id, text: obj.label}
})};
},
},
createTag: function(params) {
return undefined;
},
});
}) })
</script> </script>

@ -8,6 +8,9 @@
<div class="pw-title">{% trans 'Подписка на новости' %} {{ object.name }}</div> <div class="pw-title">{% trans 'Подписка на новости' %} {{ object.name }}</div>
</header> </header>
<div class="pw-body clearfix"> <div class="pw-body clearfix">
<p id="success" style="display: none;">
{% trans 'Вы были успешно подписаны!' %}
</p>
<form id="event-news-subscribe-form" method="post" class="pw-form" action="{% url 'events:subscribe' object.event_type object.url %}"> <form id="event-news-subscribe-form" method="post" class="pw-form" action="{% url 'events:subscribe' object.event_type object.url %}">
{% csrf_token %} {% csrf_token %}
{% if not user.is_authenticated %} {% if not user.is_authenticated %}

Loading…
Cancel
Save