Много изменений по 1557 и 1581.

remotes/origin/stage6
Alexander Burdeiny 9 years ago
parent b1a25bc3f1
commit a166c93641
  1. 1
      accounts/views.py
  2. 5
      emencia/django/newsletter/admin_urls.py
  3. 42
      emencia/django/newsletter/forms.py
  4. 3
      emencia/django/newsletter/migrations/0011_update_contact.py
  5. 484
      emencia/django/newsletter/migrations/0012_auto__add_field_contact_last_mailing_date.py
  6. 103
      emencia/django/newsletter/models.py
  7. 22
      emencia/django/newsletter/templates/newsletter/AutomaticEmail.html
  8. 14
      emencia/django/newsletter/views/admin_views.py
  9. 7
      functions/models_methods.py
  10. 2
      support/dev/settings.py
  11. 2
      support/prod/settings.py
  12. 2
      templates/client/accounts/mailing_settings.html

@ -113,6 +113,7 @@ class MailingSettings(ContextMixin, AjaxableResponseMixin, CreateUpdateView):
print(form.cleaned_data) print(form.cleaned_data)
print(form.errors) print(form.errors)
print(self.request.POST) print(self.request.POST)
import pdb; pdb.set_trace()
return super(MailingSettings, self).form_valid(form) return super(MailingSettings, self).form_valid(form)
def form_invalid(self, form): def form_invalid(self, form):

@ -19,7 +19,8 @@ from emencia.django.newsletter.views.admin_views import (
UpdateContact, UpdateContact,
UpdateMailingList, UpdateMailingList,
NewsletterCancelView, NewsletterCancelView,
theme_for_filter_ajax theme_for_filter_ajax,
AutomaticEmailTest,
) )
urlpatterns = patterns('', urlpatterns = patterns('',
@ -50,5 +51,7 @@ urlpatterns = patterns('',
url(r'^contact/export/$', ExportContacts.as_view(), name='export_contacts'), url(r'^contact/export/$', ExportContacts.as_view(), name='export_contacts'),
url(r'^contact/import/$', ImportContacts.as_view(), name='import_newsletters_contacts'), url(r'^contact/import/$', ImportContacts.as_view(), name='import_newsletters_contacts'),
url(r'^test/$', AutomaticEmailTest.as_view(), name='automaticemailtest'),
url(r'get-popup-statistics/$', PopupStatisticsView.as_view(), name='popup_statistics'), url(r'get-popup-statistics/$', PopupStatisticsView.as_view(), name='popup_statistics'),
) )

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""Forms for emencia.django.newsletter""" """Forms for emencia.django.newsletter"""
from datetime import date, datetime, timedelta from datetime import date, datetime, timedelta
from itertools import groupby
import xlrd import xlrd
from haystack.query import SearchQuerySet
from django import forms from django import forms
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
@ -12,6 +12,8 @@ from django.utils import translation
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_text, force_text from django.utils.encoding import smart_text, force_text
from haystack.query import SearchQuerySet
from emencia.django.newsletter.models import ( from emencia.django.newsletter.models import (
Contact, Contact,
ContactMailingStatus, ContactMailingStatus,
@ -28,6 +30,16 @@ from functions.search_forms import get_by_lang
from functions.model_utils import EnumChoices from functions.model_utils import EnumChoices
class AutomaticEmailTestForm(forms.Form):
date = forms.DateField(
label=_(u'Дата'),
input_formats=['%Y-%m-%d', '%d.%m.%Y'],
widget=forms.DateInput(
attrs={'class': 'date', 'id': 'dateFrom',
'placeholder': _(u'дд.мм.гггг')}))
email = forms.EmailField(label=_(u'Email'))
class MailingListSubscriptionForm(forms.ModelForm): class MailingListSubscriptionForm(forms.ModelForm):
"""Form for subscribing to a mailing list""" """Form for subscribing to a mailing list"""
# Notes : This form will not check the uniquess of # Notes : This form will not check the uniquess of
@ -119,8 +131,8 @@ class MailingSettingsForm(forms.ModelForm):
'content_articles': forms.CheckboxInput(), 'content_articles': forms.CheckboxInput(),
} }
def __init__(self, *args, **kwargs): # def __init__(self, *args, **kwargs):
super(MailingSettingsForm, self).__init__(*args, **kwargs) # super(MailingSettingsForm, self).__init__(*args, **kwargs)
# self.fields['f_countries'].queryset = Country.objects.none() # self.fields['f_countries'].queryset = Country.objects.none()
# self.fields['r_cities'].queryset = City.objects.none() # self.fields['r_cities'].queryset = City.objects.none()
# self.fields['tags'].queryset = Tag.objects.none() # self.fields['tags'].queryset = Tag.objects.none()
@ -137,10 +149,32 @@ class MailingSettingsForm(forms.ModelForm):
def save(self): def save(self):
obj = super(MailingSettingsForm, self).save(commit=False) obj = super(MailingSettingsForm, self).save(commit=False)
# В форме можеть быть выбрана:
# 1. Area и внутри для уточнения не выбрана ни одна страна
# 2. Area и внутри выбрано одна или несколько стран
# Мы проверяем первый случай и добавляем все страны из данной зоны.
countries_add = set()
areas_cleaned = self.cleaned_data.get('area')
f_countries_cleaned = set(self.cleaned_data.get('f_countries')\
.order_by('pk')\
.values_list('pk', flat=True))
if areas_cleaned.exists():
areas = areas_cleaned\
.prefetch_related('country')\
.order_by('pk')\
.values_list('pk', 'country__pk')
for area, group in groupby(areas, lambda x: x[0]):
c = set(map(lambda x: x[1], group))
if not c.intersection(f_countries_cleaned):
countries_add.update(c)
if countries_add:
obj.f_countries.add(*countries_add)
#
obj.tags = self.cleaned_data.get('tg') or [] obj.tags = self.cleaned_data.get('tg') or []
obj.themes = self.cleaned_data.get('th') or [] obj.themes = self.cleaned_data.get('th') or []
obj.save() obj.save()
return obj
class AllMailingListSubscriptionForm(MailingListSubscriptionForm): class AllMailingListSubscriptionForm(MailingListSubscriptionForm):
"""Form for subscribing to all mailing list""" """Form for subscribing to all mailing list"""

@ -6,7 +6,7 @@ from django.db import models, transaction
from city.models import City from city.models import City
from country.models import Country from country.models import Country
from emencia.django.newsletter.models import Contact # from emencia.django.newsletter.models import Contact
# from theme.models import Theme # from theme.models import Theme
@ -17,6 +17,7 @@ class Migration(DataMigration):
# Note: Don't use "from appname.models import ModelName". # Note: Don't use "from appname.models import ModelName".
# Use orm.ModelName to refer to models in this application, # Use orm.ModelName to refer to models in this application,
# and orm['appname.ModelName'] for models in other applications. # and orm['appname.ModelName'] for models in other applications.
Contact = orm['newsletter.Contact']
moscow = City.objects.language('ru').get(name=u'Москва').pk moscow = City.objects.language('ru').get(name=u'Москва').pk
russia = Country.objects.language('ru').get(name=u'Россия').pk russia = Country.objects.language('ru').get(name=u'Россия').pk
r_cities = set(City.objects.filter(country_id=russia).values_list('pk', flat=True)) r_cities = set(City.objects.filter(country_id=russia).values_list('pk', flat=True))

@ -0,0 +1,484 @@
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Contact.last_mailing_date'
db.add_column(u'newsletter_contact', 'last_mailing_date',
self.gf('django.db.models.fields.DateField')(null=True, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Contact.last_mailing_date'
db.delete_column(u'newsletter_contact', 'last_mailing_date')
models = {
u'accounts.user': {
'Meta': {'ordering': "['-rating']", 'object_name': 'User'},
'blocked': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'company': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'users'", 'null': 'True', 'to': u"orm['company.Company']"}),
'date_joined': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'date_registered': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '255', 'db_index': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_admin': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'organiser': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['organiser.Organiser']", 'unique': 'True', 'null': 'True', 'on_delete': 'models.PROTECT', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'position': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'rating': ('django.db.models.fields.IntegerField', [], {'default': '100'}),
'translator': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': u"orm['translator.Translator']", 'blank': 'True', 'unique': 'True'}),
'url': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'blank': 'True'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'})
},
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'city.city': {
'Meta': {'unique_together': '()', 'object_name': 'City', 'index_together': '()'},
'code_IATA': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['directories.Iata']", 'null': 'True', 'blank': 'True'}),
'country': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'cities'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': u"orm['country.Country']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'inflect': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'old_url': ('django.db.models.fields.CharField', [], {'max_length': '55'}),
'phone_code': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'population': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'services': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}),
'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'})
},
u'company.company': {
'Meta': {'ordering': "['-rating', 'id']", 'unique_together': '()', 'object_name': 'Company', 'index_together': '()'},
'address': ('functions.custom_fields.LocationField', [], {'blank': 'True'}),
'blocked': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'city': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'companies'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': u"orm['city.City']"}),
'country': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'companies'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': u"orm['country.Country']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_company'", 'null': 'True', 'to': u"orm['accounts.User']"}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'facebook': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'fax': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}),
'foundation': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'linkedin': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'phone': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}),
'rating': ('django.db.models.fields.IntegerField', [], {'default': '100'}),
'staff_number': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'tag': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'companies'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['theme.Tag']"}),
'theme': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'companies'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['theme.Theme']"}),
'twitter': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'url': ('django.db.models.fields.SlugField', [], {'max_length': '255'}),
'vk': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'web_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'country.area': {
'Meta': {'ordering': "['translations__name']", 'unique_together': '()', 'object_name': 'Area', 'index_together': '()'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
u'country.country': {
'Meta': {'ordering': "['translations__name']", 'unique_together': '()', 'object_name': 'Country', 'index_together': '()'},
'area': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['country.Area']"}),
'big_cities': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'cities'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['city.City']"}),
'capital': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'capital'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': u"orm['city.City']"}),
'country_code': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'currency': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['directories.Currency']", 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'inflect': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'language': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['directories.Language']", 'null': 'True', 'blank': 'True'}),
'latitude': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'blank': 'True'}),
'longitude': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'old_url': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '55'}),
'phone_code': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'population': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'services': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}),
'teritory': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'time_delivery': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'timezone': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'})
},
u'directories.currency': {
'Meta': {'unique_together': '()', 'object_name': 'Currency', 'index_together': '()'},
'code': ('django.db.models.fields.CharField', [], {'max_length': '3'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
u'directories.iata': {
'Meta': {'object_name': 'Iata'},
'airport': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'code': ('django.db.models.fields.CharField', [], {'max_length': '4'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
u'directories.language': {
'Meta': {'unique_together': '()', 'object_name': 'Language', 'index_together': '()'},
'code': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
u'file.filemodel': {
'Meta': {'unique_together': '()', 'object_name': 'FileModel', 'index_together': '()'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']", 'null': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'file_path': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'file_type': ('functions.custom_fields.EnumField', [], {'default': "'PDF'", 'values': "('PDF', 'DOC', 'TXT', 'OTHER', 'JPG', 'BMP', 'PNG', 'GIF')", 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'img_height': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'img_width': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'purpose': ('functions.custom_fields.EnumField', [], {'default': "'photo'", 'values': "['photo', 'flat', 'logo', 'map', 'scheme teritory', 'diplom', 'preview', 'preview2']"})
},
u'newsletter.attachment': {
'Meta': {'object_name': 'Attachment'},
'file_attachment': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'newsletter': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['newsletter.Newsletter']"}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
u'newsletter.contact': {
'Meta': {'ordering': "('-modification_date',)", 'object_name': 'Contact'},
'activated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'activation_code': ('django.db.models.fields.CharField', [], {'default': "'ef84ad15b8926224ef3ce9662ad71382cc61f985'", 'max_length': '40'}),
'content_articles': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'content_news': ('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'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '255'}),
'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'}),
'foreign': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'from_users': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_mailing_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'moscow': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'periodic': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '1'}),
'periodic_day': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '1'}),
'r_cities': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['city.City']", 'null': 'True', 'blank': 'True'}),
'russia': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'subscriber': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['theme.Tag']", 'null': 'True', 'blank': 'True'}),
'tester': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'themes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['theme.Theme']", 'null': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['accounts.User']", 'null': 'True'}),
'valid': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
},
u'newsletter.contactmailingstatus': {
'Meta': {'ordering': "('-creation_date',)", 'object_name': 'ContactMailingStatus'},
'ab': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'contact': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['newsletter.Contact']"}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'link': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['newsletter.Link']", 'null': 'True', 'blank': 'True'}),
'newsletter': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['newsletter.Newsletter']"}),
'status': ('django.db.models.fields.IntegerField', [], {})
},
u'newsletter.contactsettings': {
'Meta': {'object_name': 'ContactSettings'},
'area': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['country.Area']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['city.City']", 'null': 'True', 'blank': 'True'}),
'contact': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['newsletter.Contact']", 'unique': 'True'}),
'country': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['country.Country']", 'null': 'True', 'blank': 'True'}),
'exponent_practicum': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'organiser_practicum': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'periodic': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'theme': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['theme.Theme']", 'null': 'True', 'blank': 'True'})
},
u'newsletter.link': {
'Meta': {'ordering': "('-creation_date',)", 'object_name': 'Link'},
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'url': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
u'newsletter.mailinglist': {
'Meta': {'ordering': "('-creation_date',)", 'object_name': 'MailingList'},
'announce': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'announce_public_day': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'subscribers': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'mailinglist_subscriber'", 'symmetrical': 'False', 'to': u"orm['newsletter.Contact']"}),
'theme_for_filter': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['theme.Theme']", 'null': 'True', 'blank': 'True'}),
'unsubscribers': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'mailinglist_unsubscriber'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['newsletter.Contact']"})
},
u'newsletter.newsletter': {
'Meta': {'ordering': "('-creation_date',)", 'object_name': 'Newsletter'},
'ab_final_choice': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'ab_final_stage': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'ab_first_stage': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'ab_testing': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'content': ('django.db.models.fields.TextField', [], {'default': "''"}),
'content2': ('django.db.models.fields.TextField', [], {'default': "''"}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'header_reply': ('django.db.models.fields.CharField', [], {'default': "'Expomap<mail@expomap.ru>'", 'max_length': '255'}),
'header_sender': ('django.db.models.fields.CharField', [], {'default': "'Expomap<mail@expomap.ru>'", 'max_length': '255'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mailing_list': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['newsletter.MailingList']"}),
'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'preheader': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'preheader2': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'sending_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'server': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['newsletter.SMTPServer']"}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'test_contacts': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['newsletter.Contact']", 'null': 'True', 'blank': 'True'}),
'theme_for_filter': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['theme.Theme']", 'null': 'True', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'title2': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
},
u'newsletter.popupcount': {
'Meta': {'ordering': "['-date']", 'unique_together': "(('theme', 'date'),)", 'object_name': 'PopupCount'},
'cnt': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'date': ('django.db.models.fields.DateField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'theme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['theme.Theme']", 'null': 'True'})
},
u'newsletter.smtpserver': {
'Meta': {'object_name': 'SMTPServer'},
'headers': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'host': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mails_hour': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'port': ('django.db.models.fields.IntegerField', [], {'default': '25'}),
'tls': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'user': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'})
},
u'newsletter.workgroup': {
'Meta': {'object_name': 'WorkGroup'},
'contacts': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['newsletter.Contact']", 'null': 'True', 'blank': 'True'}),
'group': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.Group']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mailinglists': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['newsletter.MailingList']", 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'newsletters': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['newsletter.Newsletter']", 'null': 'True', 'blank': 'True'})
},
u'organiser.organiser': {
'Meta': {'unique_together': '()', 'object_name': 'Organiser', 'index_together': '()'},
'active': ('django.db.models.fields.NullBooleanField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'address': ('functions.custom_fields.LocationField', [], {'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['city.City']", 'null': 'True', 'on_delete': 'models.PROTECT', 'blank': 'True'}),
'country': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['country.Country']", 'null': 'True', 'on_delete': 'models.PROTECT', 'blank': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'events_number': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'facebook': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'fax': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}),
'foundation': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'linkedin': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'phone': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}),
'place_conference': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'organiser_place_conference'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['place_conference.PlaceConference']"}),
'place_exposition': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'organiser_place_exposition'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['place_exposition.PlaceExposition']"}),
'rating': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'staff_number': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tag': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['theme.Tag']", 'null': 'True', 'blank': 'True'}),
'theme': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['theme.Theme']", 'null': 'True', 'blank': 'True'}),
'twitter': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'url': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'blank': 'True'}),
'vk': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'web_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})
},
u'photologue.gallery': {
'Meta': {'ordering': "['-date_added']", 'unique_together': '()', 'object_name': 'Gallery', 'index_together': '()'},
'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'photos': ('sortedm2m.fields.SortedManyToManyField', [], {'blank': 'True', 'related_name': "'galleries'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['photologue.Photo']"}),
'sites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['sites.Site']", 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '200'}),
'tags': ('photologue.models.TagField', [], {'max_length': '255', 'blank': 'True'})
},
u'photologue.photo': {
'Meta': {'ordering': "['sort']", 'unique_together': '()', 'object_name': 'Photo', 'index_together': '()'},
'crop_from': ('django.db.models.fields.CharField', [], {'default': "'center'", 'max_length': '10', 'blank': 'True'}),
'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'date_taken': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'effect': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'photo_related'", 'null': 'True', 'to': u"orm['photologue.PhotoEffect']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'sites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['sites.Site']", 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '200'}),
'sort': ('django.db.models.fields.PositiveIntegerField', [], {'default': '10', 'null': 'True', 'db_index': 'True'}),
'tags': ('photologue.models.TagField', [], {'max_length': '255', 'blank': 'True'}),
'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['photologue.UserMark']", 'null': 'True', 'symmetrical': 'False'}),
'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
},
u'photologue.photoeffect': {
'Meta': {'object_name': 'PhotoEffect'},
'background_color': ('django.db.models.fields.CharField', [], {'default': "'#FFFFFF'", 'max_length': '7'}),
'brightness': ('django.db.models.fields.FloatField', [], {'default': '1.0'}),
'color': ('django.db.models.fields.FloatField', [], {'default': '1.0'}),
'contrast': ('django.db.models.fields.FloatField', [], {'default': '1.0'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'filters': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
'reflection_size': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'reflection_strength': ('django.db.models.fields.FloatField', [], {'default': '0.6'}),
'sharpness': ('django.db.models.fields.FloatField', [], {'default': '1.0'}),
'transpose_method': ('django.db.models.fields.CharField', [], {'max_length': '15', 'blank': 'True'})
},
u'photologue.usermark': {
'Meta': {'object_name': 'UserMark'},
'height': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'left': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
'top': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'marks'", 'to': u"orm['accounts.User']"}),
'width': ('django.db.models.fields.PositiveSmallIntegerField', [], {})
},
u'place_conference.placeconference': {
'Meta': {'unique_together': '()', 'object_name': 'PlaceConference', 'index_together': '()'},
'address': ('functions.custom_fields.LocationField', [], {}),
'amount_halls': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'banquet_hall': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'catering': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'place_conferences'", 'on_delete': 'models.PROTECT', 'to': u"orm['city.City']"}),
'conference_call': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'country': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['country.Country']", 'on_delete': 'models.PROTECT'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'exp_hall_area': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'exposition_hall': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'fax': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}),
'foundation_year': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'hotel': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'multimedia_equipment': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'phone': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}),
'total_capacity': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'translate_equipment': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'type': ('functions.custom_fields.EnumField', [], {'default': "'Convention centre'", 'values': "['Convention centre', 'Exposition centre']"}),
'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
'video_link': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'views': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'virtual_tour': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'web_page': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'wifi': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'})
},
u'place_exposition.placeexposition': {
'Meta': {'ordering': "['-rating', 'id']", 'unique_together': '()', 'object_name': 'PlaceExposition', 'index_together': '()'},
'address': ('functions.custom_fields.LocationField', [], {}),
'bank': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'business_centre': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'cafe': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'children_room': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'place_expositions'", 'on_delete': 'models.PROTECT', 'to': u"orm['city.City']"}),
'closed_area': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'conference_centre': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'country': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['country.Country']", 'on_delete': 'models.PROTECT'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'disabled_service': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'event_in_year': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'fax': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}),
'foundation_year': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_published': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'blank': 'True'}),
'mobile_application': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'online_registration': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'open_area': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'parking': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'partner': ('django.db.models.fields.NullBooleanField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'phone': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}),
'photogallery': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['photologue.Gallery']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
'press_centre': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'rating': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'terminals': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'total_area': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'total_halls': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'total_pavilions': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'type': ('functions.custom_fields.EnumField', [], {'default': "'Exposition complex'", 'values': "['Exposition complex', 'Convention centre', 'Exposition centre']"}),
'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
'views': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'virtual_tour': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'web_page': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'wifi': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'})
},
u'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'theme.tag': {
'Meta': {'unique_together': '()', 'object_name': 'Tag', 'index_together': '()'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'inflect': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'old_url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
'theme': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tags'", 'on_delete': 'models.PROTECT', 'to': u"orm['theme.Theme']"}),
'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'})
},
u'theme.theme': {
'Meta': {'unique_together': '()', 'object_name': 'Theme', 'index_together': '()'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'inflect': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'main_page_conf': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
'main_page_expo': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
'old_url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
'types': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}),
'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'})
},
u'translator.translator': {
'Meta': {'unique_together': '()', 'object_name': 'Translator', 'index_together': '()'},
'birth': ('django.db.models.fields.DateField', [], {}),
'car': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'gender': ('functions.custom_fields.EnumField', [], {'default': "'male'", 'values': "('male', 'female')"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
}
}
complete_apps = ['newsletter']

@ -3,14 +3,17 @@
from smtplib import SMTP from smtplib import SMTP
from datetime import datetime from datetime import datetime
from datetime import timedelta from datetime import timedelta
from dateutil import relativedelta
from email.MIMEImage import MIMEImage from email.MIMEImage import MIMEImage
import copy import copy
import operator
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
from django.utils.encoding import smart_str from django.utils.encoding import smart_str
from django.utils.encoding import force_unicode from django.utils.encoding import force_unicode
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import activate
from django.conf import settings from django.conf import settings
from django.core.mail import EmailMessage from django.core.mail import EmailMessage
from django.core.validators import MaxValueValidator, MinValueValidator from django.core.validators import MaxValueValidator, MinValueValidator
@ -34,6 +37,12 @@ from emencia.django.newsletter.utils import make_activation_code
from functions.form_check import translit_with_separator from functions.form_check import translit_with_separator
from functions.model_utils import EnumChoices from functions.model_utils import EnumChoices
from exposition.models import Exposition
from conference.models import Conference
from article.models import Article
from haystack.query import SearchQuerySet, RelatedSearchQuerySet, SQ
from haystack.inputs import Exact
class SMTPServer(models.Model): class SMTPServer(models.Model):
"""Configuration of a SMTP server""" """Configuration of a SMTP server"""
@ -160,6 +169,8 @@ class Contact(models.Model):
creation_date = models.DateTimeField(_('creation date'), auto_now_add=True) creation_date = models.DateTimeField(_('creation date'), auto_now_add=True)
modification_date = models.DateTimeField(_('modification date'), auto_now=True) modification_date = models.DateTimeField(_('modification date'), auto_now=True)
last_mailing_date = models.DateField(_(u'Дата посленего автоматического письма'), blank=True, null=True)
objects = ContactManager() objects = ContactManager()
@ -185,11 +196,95 @@ class Contact(models.Model):
return self.content_object.get_absolute_url() return self.content_object.get_absolute_url()
return reverse('admin:newsletter_contact_change', args=(self.pk,)) return reverse('admin:newsletter_contact_change', args=(self.pk,))
def get_announce_context_v2(self, date=None):
date = date or datetime.today().date()
activate('ru')
ctx = {
'recomended': [],
'moscow': [],
'russia': [],
'foreign': [],
'news': [],
'blog': [],
}
th_tg_filter_params = []
th_tg_structure = {}
th_tg_filter = None
for tag, theme in self.tags.values_list('pk', 'theme_id'):
th_tg_structure.setdefault(theme, []).append(tag)
for theme in self.themes.values_list('pk', flat=True):
th_tg_structure.setdefault(theme, [])
if th_tg_structure:
for theme, tags in th_tg_structure.iteritems():
p = {'theme': theme}
if tags:
p.update({'tag__in': tags})
th_tg_filter_params.append(SQ(**p))
th_tg_filter = reduce(operator.or_, th_tg_filter_params)
# recomended
recomended = RelatedSearchQuerySet().models(Exposition, Conference)
if th_tg_filter:
recomended = recomended.filter(th_tg_filter)
try:
ctx['recomended'] = recomended[0]
except:
pass
# moscow
if self.moscow:
moscow_sqs = RelatedSearchQuerySet().models(Exposition, Conference)\
.filter(city_id=Exact(settings.MOSCOW_PK), data_begin__gte=date)
if th_tg_filter is not None:
moscow_sqs = moscow_sqs.filter(th_tg_filter)
ctx['moscow'] = moscow_sqs.order_by('data_begin')[:4]
# russia
if self.russia:
r_cities = set(self.r_cities.values_list('pk', flat=True))
r_date = date + relativedelta.relativedelta(months=1)
russia_sqs = RelatedSearchQuerySet().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:
russia_sqs = russia_sqs.filter(city_id__in=r_cities)
if th_tg_filter is not None:
russia_sqs = russia_sqs.filter(th_tg_filter)
ctx['russia'] = russia_sqs.order_by('data_begin')[:3]
# foreign
if self.foreign:
f_countries = set(self.f_countries.values_list('pk', flat=True))
foreign_sqs = RelatedSearchQuerySet().models(Exposition, Conference)\
.filter(country_id__in=f_countries, data_begin__gte=date)
if th_tg_filter is not None:
foreign_sqs = foreign_sqs.filter(th_tg_filter)
ctx['foreign'] = foreign_sqs.order_by('data_begin')[:4]
# news
if self.content_news:
news = Article.objects.news().filter(draft=False)
if self.last_mailing_date:
news = news.filter(publish_date__gte=self.last_mailing_date)
try:
ctx['news'] = news.order_by('-publish_date')[0]
except:
pass
# blog
if self.content_articles:
blog = Article.objects.blogs()
if self.last_mailing_date:
blog = blog.filter(publish_date__gte=self.last_mailing_date)
try:
ctx['blog'] = blog.order_by('-publish_date')[0]
except:
pass
return ctx
def get_announce_context(self): def get_announce_context(self):
from exposition.models import Exposition
from conference.models import Conference
from article.models import Article
from django.utils.translation import activate
activate('ru') activate('ru')
expo = Exposition.enable.upcoming() expo = Exposition.enable.upcoming()
conf = Conference.enable.upcoming() conf = Conference.enable.upcoming()

@ -0,0 +1,22 @@
{% load i18n %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="{{ LANGUAGE_CODE }}" lang="{{ LANGUAGE_CODE }}" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="language" content="{{ LANGUAGE_CODE }}" />
<meta name="description" content="{% block meta-description %}Emencia Django Newsletter for sending newsletter.{% endblock %}" />
<meta name="author" content="Fantomas42" />
<title>{% trans "Emencia Django Newsletter" %} - {% block title %}{% endblock %}</title>
</head>
<body>
<h1>{% trans "Emencia Django Newsletter" %}</h1>
<form action="." method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Сгенерировать</button>
</form>
{% block content %}
{% endblock %}
</body>
</html>

@ -40,15 +40,27 @@ from emencia.django.newsletter.models import (
Newsletter Newsletter
) )
from functions.admin_views import paginate_results from functions.admin_views import paginate_results
from functions.custom_views import ContextMixin
from functions.http import JsonResponse from functions.http import JsonResponse
from HTMLParser import HTMLParseError from HTMLParser import HTMLParseError
from theme.models import Theme from theme.models import Theme
from ..forms import ContactFilterForm, ContactImportForm from ..forms import ContactFilterForm, ContactImportForm, AutomaticEmailTestForm
from ..models import PopupCount from ..models import PopupCount
from ..utils.excel import ExcelResponse from ..utils.excel import ExcelResponse
class AutomaticEmailTest(ContextMixin, FormView):
form_class = AutomaticEmailTestForm
template_name = 'newsletter/AutomaticEmail.html'
# success_url = reverse_lazy('automaticemailtest')
def form_valid(self, form):
contact = Contact.objects.get(email=form.cleaned_data.get('email'))
self.extra_ctx.update(contact.get_announce_context_v2(date=form.cleaned_data.get('date')))
return self.form_invalid(form)
class ContactList(FormView): class ContactList(FormView):
paginate_by = settings.ADMIN_PAGINATION paginate_by = settings.ADMIN_PAGINATION
model = Contact model = Contact

@ -1,10 +1,13 @@
# -*- coding: utf-8 -*-
import datetime import datetime
from django.utils.translation import get_language from django.utils.translation import get_language
from django.db.models import Q from django.db.models import Q
from django.core.cache import cache from django.core.cache import cache
from django.utils import translation from django.utils import translation
from hvad.models import TranslationManager from django.conf import settings
from hvad.models import TranslationManager
class ExpoManager(TranslationManager): class ExpoManager(TranslationManager):
@ -193,7 +196,7 @@ class CityManager(TranslationManager):
self.language(lang).filter( self.language(lang).filter(
country__url='russia', exposition_city__isnull=False, country__url='russia', exposition_city__isnull=False,
conference_city__isnull=False conference_city__isnull=False
).distinct().order_by('name').values_list('pk', 'name') ).exclude(pk=settings.MOSCOW_PK).distinct().order_by('name').values_list('pk', 'name')
) )
cache.set(key, cities, self.cache_time) cache.set(key, cities, self.cache_time)
return cities return cities

@ -493,6 +493,8 @@ MONTHES = {'jan': {'value': 1, 'name': _(u'Январь')}, 'feb': {'value': 2,
'nov': {'value': 11, 'name': _(u'Ноябрь')}, 'dec': {'value': 12, 'name': _(u'Декабрь')}} 'nov': {'value': 11, 'name': _(u'Ноябрь')}, 'dec': {'value': 12, 'name': _(u'Декабрь')}}
SNG_COUNTRIES = [159, 186, 31, 6, 99, 13, 189, 64] SNG_COUNTRIES = [159, 186, 31, 6, 99, 13, 189, 64]
RUSSIA_PK = 159
MOSCOW_PK = -2960561
CLIENT_DATE_FORMAT = ["%d.%m.%Y"] CLIENT_DATE_FORMAT = ["%d.%m.%Y"]

@ -492,6 +492,8 @@ MONTHES = {'jan': {'value': 1, 'name': _(u'Январь')}, 'feb': {'value': 2,
'nov': {'value': 11, 'name': _(u'Ноябрь')}, 'dec': {'value': 12, 'name': _(u'Декабрь')}} 'nov': {'value': 11, 'name': _(u'Ноябрь')}, 'dec': {'value': 12, 'name': _(u'Декабрь')}}
SNG_COUNTRIES = [159, 186, 31, 6, 99, 13, 189, 64] SNG_COUNTRIES = [159, 186, 31, 6, 99, 13, 189, 64]
RUSSIA_PK = 159
MOSCOW_PK = -2960561
CLIENT_DATE_FORMAT = ["%d.%m.%Y"] CLIENT_DATE_FORMAT = ["%d.%m.%Y"]

@ -5,7 +5,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title> <title>{% trans 'Настройте рассылку от Expomap' %}</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.min.css">
<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/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="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">

Loading…
Cancel
Save