Revert "resolve conflict"

This reverts commit cbf649ebe3, reversing
changes made to 7011f2a2fb.
remotes/origin/1203
pavel 11 years ago
parent cbf649ebe3
commit e4de1447b2
  1. 50
      accounts/models.py
  2. 43
      article/management/commands/articles_from_old.py
  3. 59
      article/management/commands/news_from_old.py
  4. 62
      article/models.py
  5. 2
      article/urls.py
  6. 2
      article/views.py
  7. 6
      company/models.py
  8. 7
      core/simple_index_view.py
  9. 22
      exposition/admin.py
  10. 55
      exposition/forms.py
  11. 74
      exposition/management/commands/expo_test.py
  12. 31
      exposition/management/commands/fix_logo.py
  13. 65
      exposition/management/commands/imp_stat.py
  14. 21
      exposition/models.py
  15. 32
      proj/admin.py
  16. 2
      proj/admin_urls.py
  17. 14
      service/models.py
  18. 6
      service/order_forms.py
  19. 11
      service/urls.py
  20. 26
      service/views.py
  21. 32
      settings/templatetags/template_filters.py
  22. 47
      static/custom_js/main.js
  23. 17
      templates/admin/base.html
  24. 37
      templates/admin/exposition/exposition.html
  25. 58
      templates/admin/includes/stat_form.html
  26. 37
      templates/admin/service/order_list.html
  27. 4
      templates/client/article/article.html
  28. 8
      templates/client/article/blog_list.html
  29. 6
      templates/client/article/news_list.html
  30. 34
      templates/client/exposition/statistic.html
  31. 2
      templates/client/includes/accounts/current_user.html
  32. 2
      templates/client/includes/accounts/simple_user.html
  33. 6
      templates/client/includes/company/company_edit.html
  34. 33
      templates/client/includes/company/company_object.html
  35. 36
      templates/client/includes/exposition/statistic.html
  36. 4
      templates/client/popups/callback.html
  37. 3
      theme/views.py

@ -409,3 +409,53 @@ def post_profile(sender, instance, created, **kwargs):
post_save.connect(create_user_inf, sender=User)
post_save.connect(post_profile, sender=Profile)
#need import after User Model, because User imported in "organiser.models"
#from organiser.models import Organiser
'''
def create_profiles(sender, **kw):
"""
create Translator profile if "is_translator" field in User model true
if it's false delete Translator profile connected to User
create Organiser profile if "is_organiser" field in User model true
if it's false delete Organiser profile connected to User
"""
user = kw["instance"]
if user.is_translator and not user.translator.all():
#check flag is_translator and if translator profile already exist
translator = TranslatorProfile(user=user)
translator.save()
if not user.is_translator:
TranslatorProfile.objects.filter(user = user).delete()
if user.is_organiser and not user.organiser.all():
#check flag is_organiser and if organiser profile already exist
organiser = Organiser(user=user)
if user.country:
organiser.country = user.country
if user.city:
organiser.city = user.city
organiser.save()
data = {'name_ru':user.get_full_name()}
zero_fields = {}
fill_trans_fields_all(Organiser, organiser, data, None, zero_fields)
#populate empty fields and fields which was already populated
organiser_id = getattr(organiser, 'id')
populate_all(Organiser, data, organiser_id, zero_fields)
if not user.is_organiser:
Organiser.objects.filter(user = user).delete()
post_save.connect(create_profiles, sender=User)
'''

@ -4,7 +4,6 @@ from MySQLdb.cursors import DictCursor
from django.core.management.base import BaseCommand, CommandError
from functions.translate import fill_with_signal
from article.models import Article
from accounts.models import User
class Command(BaseCommand):
@ -16,48 +15,8 @@ class Command(BaseCommand):
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
sql = """SELECT articles_description.articles_id as id ,
articles_description.articles_name as main_title,
articles_description.articles_description as description,
articles.authors_id as author,
articles_description.articles_intro as preview,
articles.articles_date_added as created,
articles.articles_last_modified as modified,
articles.articles_date_available as publish_date,
articles_description.articles_head_title_tag as title,
articles_description.articles_head_desc_tag as descriptions,
articles_description.articles_head_keywords_tag as keywords
sql = """SELECT articles_description.articles_id as id , articles_description.articles_name as name, articles_description.articles_description as description, articles_description.articles_head_title_tag as title, articles_description.articles_head_desc_tag as descriptions, articles_description.articles_head_keywords_tag as keywords, articles_description.articles_intro as main_title, articles.articles_date_added as created, articles.articles_last_modified as modified
FROM `articles_description`
JOIN articles
ON articles_description.articles_id=articles.articles_id"""
cursor.execute(sql)
result = cursor.fetchall()
user = User.objects.get(id=1)
Article.objects.blogs().delete()
for a in result:
article = Article(type=Article.blog,
id=a['id'],
created=a['created'],
modified=a['modified'],
publish_date=a['publish_date'])
article.author = user
article.translate('ru')
article.main_title = a['main_title']
article.preview = a['preview']
article.description = a['description']
article.title = a['title']
article.keywords = a['keywords']
if len(a['descriptions'])<255:
article.descriptions = a['descriptions']
article.save()
print(article)
#print(a['main_title'])

@ -1,59 +0,0 @@
# -*- coding: utf-8 -*-
import MySQLdb
from MySQLdb.cursors import DictCursor
from django.core.management.base import BaseCommand, CommandError
from functions.translate import fill_with_signal
from article.models import Article
from accounts.models import User
class Command(BaseCommand):
def handle(self, *args, **options):
db = MySQLdb.connect(host="localhost",
user="kotzilla",
passwd="qazedc",
db="old_expomap",
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
sql = """SELECT news_id as id ,
headline as main_title,
content as description,
cid as author,
date_added as created
FROM `latest_news`"""
cursor.execute(sql)
result = cursor.fetchall()
user = User.objects.get(id=1)
c = 0
for a in result:
if len(a['main_title'])>255 or not a['main_title']:
continue
article = Article(type=Article.news,
id=a['id'],
created=a['created'])
if a['author']:
try:
author = User.objects.get(id=a['author'])
except User.DoesNotExist:
author = user
else:
author = user
article.author = author
article.translate('ru')
article.main_title = a['main_title']
article.description = a['description']
article.save()
print(article)
#print(a['main_title'])

@ -81,9 +81,9 @@ class Article(TranslatableModel):
#translated fields
translations = TranslatedFields(
main_title = models.CharField(max_length=255),
main_title = models.CharField(max_length=100),
preview = models.TextField(),
description = models.TextField(blank=False),
description = models.TextField(),
#-----meta
title = models.CharField(max_length=255, blank=True),
descriptions = models.CharField(max_length=255, blank=True),
@ -121,8 +121,8 @@ class Article(TranslatableModel):
self.slug = self.generate_unique_slug()
#Set the description field on save.
#if self.gen_description:
# self.description = strip_tags(self.description_from_content())
if self.gen_description:
self.description = strip_tags(self.description_from_content())
super(Article, self).save(*args, **kwargs)
def description_from_content(self):
@ -184,6 +184,60 @@ class Article(TranslatableModel):
"""
return self._get_next_or_previous_by_publish_date(False, **kwargs)
def clone(self):
"""
Return an identical copy of the instance with a new ID.
"""
if not self.pk:
raise ValueError('Instance must be saved before it can be cloned.')
duplicate = copy.copy(self)
# Setting pk to None. Django thinking this is a new object.
duplicate.pk = None
# url must be unique
duplicate.url += '_copy'
if Article.objects.safe_get(url=duplicate.url):
#already has copy this instance
return
ignore_fields = ['id', 'master', 'language_code']
duplicate.translate('ru')
tr = self._meta.translations_model.objects.get(language_code = 'ru',master__id=self.pk)
for field in duplicate._translated_field_names:
if field in ignore_fields:
continue
setattr(duplicate, field, getattr(tr, field))
duplicate.save()
# but lost all ManyToMany relations and Translations.
'''
# copy relations
for field in self._meta.many_to_many:
source = getattr(self, field.attname)
destination = getattr(duplicate, field.attname)
for item in source.all():
destination.add(item)
# copy translations
languages = self.get_available_languages()
ignore_fields = ['id', 'master', 'language_code']
for code in languages:
duplicate.translate(code)
tr = self._meta.translations_model.objects.get(language_code = code,master__id=self.pk)
for field in duplicate._translated_field_names:
if field in ignore_fields:
continue
setattr(duplicate, field, getattr(tr, field))
duplicate.save()
'''
return duplicate
def admin_url(self):
if self.type == 1:

@ -3,9 +3,7 @@ from django.conf.urls import patterns, url
from views import BlogList, NewsList, BlogDetail, NewsDetail
urlpatterns = patterns('',
url(r'blogs/page/(?P<page>\d+)/$', BlogList.as_view()),
url(r'blogs/$', BlogList.as_view()),
url(r'news/page/(?P<page>\d+)/$', NewsList.as_view()),
url(r'news/$', NewsList.as_view()),
url(r'blogs/(?P<slug>.*)$', BlogDetail.as_view()),
url(r'news/(?P<slug>.*)$', NewsDetail.as_view()),

@ -5,7 +5,6 @@ from models import Article
class NewsList(ListView):
model = Article
template_name = 'article/news_list.html'
paginate_by = 10
def get_queryset(self):
if self.request.GET:
@ -31,7 +30,6 @@ class NewsDetail(DetailView):
class BlogList(ListView):
model = Article
template_name = 'article/blog_list.html'
paginate_by = 10
def get_queryset(self):
if self.request.GET:

@ -128,13 +128,7 @@ def calculate_rating(company):
if getattr(company, key):
rating += value
themes = company.theme.all().count()
rating += themes * 10
tags = company.tag.all().count()
rating += tags * 10 if tags < 6 else 50
company.rating = rating
# call to prevent recursion
post_save.disconnect(create_company, sender=Company)
company.save()

@ -1,8 +1,7 @@
import json
from django.views.generic import TemplateView
from django.shortcuts import HttpResponse
#from forms import CallbackForm
from service.order_forms import CallBackForm
from forms import CallbackForm
class AdvertisingView(TemplateView):
@ -16,9 +15,9 @@ class AboutView(TemplateView):
def callback(request):
response = {'success': False}
if request.GET:
form = CallBackForm(request.GET)
form = CallbackForm(request.GET)
if form.is_valid():
form.save()
form.send()
response['success'] = True
else:
response['errors'] = form.errors

@ -241,11 +241,11 @@ class ExpositionView(AdminView):
template_name = 'admin/exposition/exposition.html'
def form_valid(self, form):
#StatisticFormSet = formset_factory(StatisticForm)
#formset_statistic = StatisticFormSet(self.request.POST)
StatisticFormSet = formset_factory(StatisticForm)
formset_statistic = StatisticFormSet(self.request.POST)
self.set_obj()
expo = form.save(obj=self.obj)
"""
# delete old halls
Statistic.objects.filter(exposition=getattr(expo, 'id')).delete()
@ -255,7 +255,7 @@ class ExpositionView(AdminView):
statistic = item.save(commit=False)
statistic.exposition = expo
statistic.save()
"""
return HttpResponseRedirect(self.success_url)
@ -331,22 +331,20 @@ class ExpositionView(AdminView):
context = super(ExpositionView, self).get_context_data(**kwargs)
obj = self.set_obj()
if obj:
#StatisticFormSet = modelformset_factory(Statistic, form=StatisticForm, exclude=('exposition',))
StatisticFormSet = modelformset_factory(Statistic, form=StatisticForm, exclude=('exposition',))
# get existing statistic
#statistic = Statistic.objects.filter(exposition=getattr(obj, 'id'))
statistic = Statistic.objects.filter(exposition=getattr(obj, 'id'))
# fill HallFormSet
#formset_statistic = StatisticFormSet(queryset=statistic)
context['stat_form'] = StatisticForm()
formset_statistic = StatisticFormSet(queryset=statistic)
context['file_form'] = FileForm(initial={'model': 'exposition.Exposition'})
files = FileModel.objects.filter(content_type=ContentType.objects.get_for_model(obj),object_id=getattr(obj, 'id'))
context['files'] = files
else:
#StatisticFormSet = formset_factory(StatisticForm)
#formset_statistic = StatisticFormSet()
pass
StatisticFormSet = formset_factory(StatisticForm)
formset_statistic = StatisticFormSet()
#context['formset_statistic'] = formset_statistic
context['formset_statistic'] = formset_statistic
context['photo_form'] = PhotoForm()
context['timetable_form'] = TimeTableForm()

@ -462,48 +462,14 @@ class ExpositionDeleteForm(forms.ModelForm):
fields = ('url',)
class StatisticForm(forms.Form):
year = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), label='Год')
visitors = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False, label='Посетители')
members = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False, label='Участники')
area = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False, label='Площадь')
countries_number = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False, label='Число стран')
def __init__(self, *args, **kwargs):
"""
create dynamical translated fields fields
"""
super(StatisticForm, self).__init__(*args, **kwargs)
#creates translated forms example: name_ru, name_en
# len(10) is a hack for detect if settings.LANGUAGES is not configured it return all langs
if len(settings.LANGUAGES) in range(10):
for lid, (code, name) in enumerate(settings.LANGUAGES):
# uses enumerate for detect iteration number
# first iteration is a default lang so it required fields
required = True if lid == 0 else False
self.fields['countries_%s' % code] = forms.CharField(label=u'Участвующие страны',
required=False,
widget=forms.TextInput(attrs={'style':'width: 250px'}))
def save(self, exposition=None):
data = self.cleaned_data
if not exposition:
return None
else:
stat = Statistic()
# simple fields
stat.exposition = exposition
stat.year = data['year']
stat.visitors = data.get('visitors')
stat.members = data.get('members')
stat.area = data.get('area')
stat.countries_number = data.get('countries_number')
fill_with_signal(Statistic, stat, data)
return stat
class StatisticForm(forms.ModelForm):
year = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}))
visitors = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False)
members = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False)
area = forms.CharField(widget=forms.TextInput(attrs={'style': 'width:70px'}), required=False)
class Meta:
model = Statistic
exclude = ('exposition')
def clean_year(self):
cleaned_data = super(StatisticForm, self).clean()
@ -520,11 +486,6 @@ class StatisticForm(forms.Form):
visitors = cleaned_data.get('visitors').strip()
return is_positive_integer(visitors)
def clean_countries_number(self):
cleaned_data = super(StatisticForm, self).clean()
countries_number = cleaned_data.get('countries_number').strip()
return is_positive_integer(countries_number)
from functions.files import check_tmp_timetables
class TimeTableForm(forms.Form):

@ -1,74 +0,0 @@
# -*- coding: utf-8 -*-
import xlrd
import urllib2
from django.core.management.base import BaseCommand
from django.conf import settings
from functions.form_check import translit_with_separator
from functions.files import get_alternative_filename
from exposition.models import Exposition, Statistic
from organiser.models import Organiser
CHINA_FILE = settings.MEDIA_ROOT+'/import/expo_china_ru.xlsx'
GERMANY_FILE = settings.MEDIA_ROOT+'/import/expo_germany_ru.xlsx'
# 391 row not imported(same url)
ITALY_FILE = settings.MEDIA_ROOT+'/import/expo_italy_ru.xlsx'
# moscow 3 exps
F = settings.MEDIA_ROOT+'/import/exp.xlsx'
LA_FILE = settings.MEDIA_ROOT+'/import/expo_la.xlsx'
NA_EU_ASIA_FILE = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa.xls'
NA_EU_ASIA_FILE2 = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa_part2.xls'
# 44
class Command(BaseCommand):
def handle(self, *args, **options):
qs = Statistic.objects.language('ru').exclude(translations__countries='')
comas = 0
enters = 0
main = 0
spaces = 0
word = 0
number = 0
for i in qs:
if ';' in i.countries:
main +=1
a = i.countries.split(';')
new = [item.strip() for item in a]
st = ';'.join(new)
print st.encode('utf8')
i.countries = st
#i.save()
elif ',' in i.countries:
comas += 1
elif '\n' in i.countries:
enters += 1
elif ' ' in i.countries:
spaces += 1
if '55' in i.countries:
continue
elif '.' in i.countries:
number += 1
#a = i.countries.split('.')
#i.countries_number = int(a[0])
#i.countries = ''
#i.save()
else:
word += 1
print('all: %d'%qs.count())
print('main: %d'%main)
print('comas: %d'%comas)
print('enter: %d'%enters)
print('spaces: %d'%spaces)
print('word: %d'%word)
print('number: %d'%number)

@ -24,7 +24,7 @@ NA_EU_ASIA_FILE2 = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa_part2.xls'
class Command(BaseCommand):
def handle(self, *args, **options):
f = open(CHINA_FILE, 'r')
f = open(NA_EU_ASIA_FILE2, 'r')
book = xlrd.open_workbook(file_contents=f.read())
sheet = book.sheet_by_index(0)
row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)]
@ -37,40 +37,25 @@ class Command(BaseCommand):
except Exposition.DoesNotExist:
continue
if exp.logo or row[19] == '':# or row[16].startswith('http') or row[16].startswith('https') or not row[16].startswith('/') or row[16].startswith('../'):
if row[16] =='' or row[16].startswith('http') or row[16].startswith('https') or row[16].startswith('/') or row[16].startswith('../'):
continue
path = row[19]
path = row[16]
file_name = path.split('/')[-1]
logo_path = exp.logo.field.upload_to
full_path = settings.MEDIA_ROOT + logo_path
try:
alt_name = get_alternative_filename(full_path, file_name)
except UnicodeEncodeError:
continue
download_to = full_path+alt_name
if path.startswith('http') or path.startswith('https'):
url = path
elif path.startswith('/'):
url = 'http://expomap.ru' + path
elif path.startswith('images'):
url = 'http://expomap.ru/' + path
else:
continue
#print('------------------------------------')
#print(path)
#print(url)
#print('------------------------------------')
alt_name = get_alternative_filename(full_path, file_name)
download_to = full_path+alt_name
url = 'http://expomap.ru/' + path
try:
response = urllib2.urlopen(url, timeout=15)
except:
continue
if response.code != 200:
continue
with open(download_to,'wb') as f:
try:

@ -1,65 +0,0 @@
# -*- coding: utf-8 -*-
import xlrd
import urllib2
from django.core.management.base import BaseCommand
from django.conf import settings
from functions.form_check import translit_with_separator
from functions.files import get_alternative_filename
from exposition.models import Exposition, Statistic
from organiser.models import Organiser
CHINA_FILE = settings.MEDIA_ROOT+'/import/expo_china_ru.xlsx'
GERMANY_FILE = settings.MEDIA_ROOT+'/import/expo_germany_ru.xlsx'
# 391 row not imported(same url)
ITALY_FILE = settings.MEDIA_ROOT+'/import/expo_italy_ru.xlsx'
# moscow 3 exps
F = settings.MEDIA_ROOT+'/import/exp.xlsx'
LA_FILE = settings.MEDIA_ROOT+'/import/expo_la.xlsx'
NA_EU_ASIA_FILE = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa.xls'
NA_EU_ASIA_FILE2 = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa_part2.xls'
class Command(BaseCommand):
def handle(self, *args, **options):
f = open(NA_EU_ASIA_FILE, 'r')
book = xlrd.open_workbook(file_contents=f.read())
sheet = book.sheet_by_index(0)
row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)]
labels = [label for label in row_list[0]]
for row_number, row in enumerate(row_list[1:]):
exp_url = translit_with_separator(row[2])
try:
exp = Exposition.objects.language('ru').get(url=exp_url)
except Exposition.DoesNotExist:
continue
if not row[30]:
continue
year = int(row[30])
try:
countries_number = int(exp.stat_countries)
countries = ''
except ValueError:
countries_number = None
countries = exp.stat_countries
members = exp.members
visitors = exp.visitors
area = exp.area
s = Statistic(exposition=exp,
year=year,
countries_number=countries_number,
members=members,
visitors=visitors,
area=area)
s.translate('ru')
s.countries = countries
s.save()
print(exp)

@ -327,22 +327,12 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
return duplicate
class Statistic(TranslatableModel):
class Statistic(models.Model):
exposition = models.ForeignKey(Exposition, related_name='statistic')
year = models.PositiveIntegerField(verbose_name='Год')
members = models.PositiveIntegerField(verbose_name='Посетители', blank=True, null=True)
visitors = models.PositiveIntegerField(verbose_name='Участники', blank=True, null=True)
area = models.PositiveIntegerField(verbose_name='Площадь', blank=True, null=True)
countries_number = models.PositiveIntegerField(verbose_name='Количество стран', blank=True, null=True)
translations = TranslatedFields(
countries = models.TextField(blank=True)
)
def to_dict(self):
return hvad_to_dict(self)
members = models.PositiveIntegerField(verbose_name='Посетители')
visitors = models.PositiveIntegerField(verbose_name='Участники')
area = models.PositiveIntegerField(verbose_name='Площадь')
from django.core import serializers
from functions.models_methods import hvad_to_dict
@ -419,5 +409,4 @@ class TmpTimeTable(TranslatableModel):
pre_save.connect(pre_save_handler, sender=Exposition)
post_save.connect(post_save_handler, sender=Exposition)
post_save.connect(post_save_handler, sender=TimeTable)
post_save.connect(post_save_handler, sender=TmpTimeTable)
post_save.connect(post_save_handler, sender=Statistic)
post_save.connect(post_save_handler, sender=TmpTimeTable)

@ -159,38 +159,6 @@ def ajax_post_timetable(request, obj_id=None):
else:
return HttpResponse('error')
from exposition.models import Statistic
from exposition.forms import StatisticForm
def ajax_post_stat(request, obj_id=None):
response = {'success': False}
if request.GET:
form = StatisticForm(request.GET)
if form.is_valid():
exp = Exposition.objects.safe_get(id=obj_id)
if exp:
form.save(exp)
response['success'] = True
else:
response.update({'errors': form.errors})
return HttpResponse(json.dumps(response), content_type='application/json')
def ajax_delete_stat(request, id):
redirect_to = request.META.get('HTTP_REFERER')
if id:
try:
Statistic.objects.get(id=id).delete()
except Statistic.DoesNotExist:
pass
return HttpResponseRedirect(redirect_to)
def ajax_delete_timetable(request):
if request.GET:

@ -36,8 +36,6 @@ urlpatterns = required(
url(r'^ajax_post_file/', 'proj.admin.ajax_post_file'),
url(r'^ajax_post_photo/(?P<obj_id>\d+)/$', 'proj.admin.ajax_post_photo'),#must be before /ajax_post_photo/
url(r'^ajax_post_photo/', 'proj.admin.ajax_post_photo'),
url(r'^ajax_post_stat/(?P<obj_id>\d+)/$', 'proj.admin.ajax_post_stat'),
url(r'^ajax_delete_stat/(?P<id>\d+)/', 'proj.admin.ajax_delete_stat'),
url(r'^ajax_post_timetable/(?P<obj_id>\d+)/$', 'proj.admin.ajax_post_timetable'),#must be before /ajax_post_timetable/
url(r'^ajax_post_timetable/', 'proj.admin.ajax_post_timetable'),
url(r'^ajax_delete_timetable/', 'proj.admin.ajax_delete_timetable'),

@ -65,12 +65,9 @@ class AbstractOrder(models.Model):
exposition = models.ForeignKey('exposition.Exposition', null=True)
conference = models.ForeignKey('conference.Conference', null=True)
seminar = models.ForeignKey('seminar.Seminar', null=True)
created = models.DateTimeField(auto_now_add=True)
viewed = models.DateTimeField(null=True, blank=True)
class Meta:
abstract = True
ordering = ['-created']
@ -127,13 +124,4 @@ class Visit(AbstractOrder):
notes = models.TextField(blank=True)
class Advertising(AbstractOrder):
pass
class CallBack(models.Model):
phone = models.CharField(max_length=30)
person_inf = models.CharField(max_length=255)
created = models.DateTimeField(auto_now_add=True)
viewed = models.DateTimeField(null=True, blank=True)
class Meta:
ordering = ['-created']
pass

@ -2,7 +2,7 @@
from django import forms
from django.utils.translation import ugettext as _
from accounts.models import User
from models import Catalog, Tickets, Remote, Participation, Translation, Visit, CURENCIES, Advertising, CallBack
from models import Catalog, Tickets, Remote, Participation, Translation, Visit, CURENCIES, Advertising
from exposition.models import Exposition
from conference.models import Conference
from seminar.models import Seminar
@ -202,7 +202,3 @@ class AdvertiseForm(AbstractOrderForm):
class Meta:
model = Advertising
class CallBackForm(forms.ModelForm):
class Meta:
model = CallBack
fields=('phone', 'person_inf')

@ -1,19 +1,10 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from views import ServiceView, CallBackListView, VisitListView, TranslationListView, AdvertisingListView, \
ParticipationListView, RemoteListView,TicketsListView
from views import ServiceView
urlpatterns = patterns('',
url(r'service/order/callback/$', CallBackListView.as_view()),
url(r'service/order/visit/$', VisitListView.as_view()),
url(r'service/order/translation/$', TranslationListView.as_view()),
url(r'service/order/advertising/$', AdvertisingListView.as_view()),
url(r'service/order/participation/$', ParticipationListView.as_view()),
url(r'service/order/remote/$', RemoteListView.as_view()),
url(r'service/order/tickets/$', TicketsListView.as_view()),
url(r'service/advertise/$', 'service.views.advertise'),
url(r'service/(?P<url>.*)/$', ServiceView.as_view()),
)

@ -48,31 +48,5 @@ def advertise(request):
return HttpResponse(json.dumps(response), content_type='application/json')
from service.models import CallBack, Visit, Translation, Advertising, Participation, Remote, Tickets
class AbstractOrderListView(ListView):
template_name = 'admin/service/order_list.html'
paginate_by = 20
class CallBackListView(AbstractOrderListView):
model = CallBack
class VisitListView(AbstractOrderListView):
model = Visit
class TranslationListView(AbstractOrderListView):
model = Translation
class AdvertisingListView(AbstractOrderListView):
model = Advertising
class ParticipationListView(AbstractOrderListView):
model = Participation
class RemoteListView(AbstractOrderListView):
model = Remote
class TicketsListView(AbstractOrderListView):
model = Tickets

@ -246,34 +246,4 @@ def in_events(day, events):
@register.filter
def base64_encode(value):
return base64.b64encode(value)
@register.filter
def generate_countries_list(value):
values = value.split(';')
values.sort()
if len(values) >= 2:
ul1 = values[::3]
ul2 = values[1::3]
ul3 = values[2::3]
elif len(values) >= 2:
ul1 = values[::2]
ul2 = values[1::2]
ul3 = []
else:
ul1 = values
ul2 = []
ul3 = []
ul1_html = ''.join(['<li>%s</li>'%i for i in ul1])
ul2_html = ''.join(['<li>%s</li>'%i for i in ul2])
ul3_html = ''.join(['<li>%s</li>'%i for i in ul3])
ul1 ='<ul>' + ul1_html + '</ul>'
ul2 ='<ul>' + ul2_html + '</ul>'
ul3 ='<ul>' + ul3_html + '</ul>'
return ul1+ul2+ul3
return base64.b64encode(value)

@ -86,30 +86,6 @@ function postTimetable(data, textStatus){
}
}
function postStat(data, textStatus){
if(data.success){
location.reload;
}
else{
$.each(data.errors, function(field_name, errors){
$('#id_'+field_name).parent().parent().addClass('error');
})
}
/*
if (data instanceof Object){
$.each(data, function(field_name, errors){
$('#id_'+field_name).parent().parent().addClass('error');
})
}
else{
$('#stat_modal table tbody').html(data);
$('#stat_form')[0].reset();
$('#stat_form .control-group').removeClass('error');
$('#close_stat').click();
}
*/
}
$(document).ready(function(){
@ -374,29 +350,6 @@ $(document).ready(function(){
});//end get
});//end change
$('#stat_form').on('submit', function(e){//submit(function(){
e.preventDefault();
var url = '/admin/ajax_post_stat/' + $('#obj_id').val() + '/';
console.log(url)
var formData = $(this).serialize();
$.ajax({
url: url, //server script to process data
type: 'GET',
//Ajax events
success: postStat,
error: function(){ alert('error'); },
// Form data
data: formData,
//Options to tell JQuery not to process data or worry about content-type
cache: false,
contentType: false,
processData: false
});//end ajax
}); // end submit
$('#timetable_form').on('submit', function(e){//submit(function(){
e.preventDefault();
tinyMCE.triggerSave();

@ -112,8 +112,8 @@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list"></i> Справочники<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/admin/article/blog/all/">Статьи</a></li>
<li><a href="/admin/article/news/all/">Новости</a></li>
<li><a href="/admin/article/blog/all">Статьи</a></li>
<li><a href="/admin/article/news/all">Новости</a></li>
<li><a href="#">Отзывы</a></li>
<li><a href="/admin/language/add">Языки</a></li>
<li><a href="/admin/currency/add">Валюты</a></li>
@ -145,19 +145,6 @@
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class=" icon-circle-arrow-up"></i> Заказы<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/admin/service/order/callback/">Обратный звонок</a></li>
<li><a href="/admin/service/order/visit/">Бизнес-тур под ключ</a></li>
<li><a href="/admin/service/order/translation/">Переводчик</a></li>
<li><a href="/admin/service/order/advertising/">Рекламировать</a></li>
<li><a href="/admin/service/order/participation/">Участие</a></li>
<li><a href="/admin/service/order/remote/">Заочное посещение</a></li>
<li><a href="/admin/service/order/tickets/">Билеты</a></li>
</ul>
</li>
</ul>
</div>

@ -494,39 +494,6 @@
</div>
</div>
{% if object %}
<div style="padding-left: 160px;{% if object %} {% else %}display: none;{% endif %}">
<table class="table table-hover" style=" width: 100%;">
<thead>
<tr>
<td>Год</td>
<td>Посетители</td>
<td>Участники</td>
<td>Площадь</td>
<td></td>
</tr>
</thead>
<tbody>
{% for stat in object.statistic.all %}
<tr>
<td>{{ stat.year }}</td>
<td>{{ stat.visitors }}</td>
<td>{{ stat.members }}</td>
<td>{{ stat.area }}</td>
<td><a class="btn btn-danger delete_stat" href="/admin/ajax_delete_stat/{{ stat.id }}/"><i class="icon-trash icon-white"></i> Удалить</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<a href="#stat_modal" id="stat_add" role="btn btn-success" class="btn btn-success" data-toggle="modal"><i class="icon-plus-sign icon-white"></i> Добавить год</a>
</div>
{% else %}
{% endif %}
{% comment %}
{% if formset_statistic.errors %}
<div class="alert alert-error">
{% for form in formset_statistic.forms %}
@ -569,7 +536,6 @@
</div>
<p style=" padding-left: 20px"><a id="add" class="btn btn-success" href="#"><i class="icon-plus-sign icon-white"></i> Добавить год</a></p>
</div>
{% endcomment %}
</div>
<div class="box span8" id="file">
<div class="box-header well">
@ -681,7 +647,7 @@
<div class="modal-footer">
<div class="controls">
<input class="btn btn-primary" type="submit" value="{% if object %}Изменить{% else %}Добавить{% endif %}">
<input class="btn btn-primary" type="submit" value="Добавить">
<input type="reset" class="btn" value="Отменить" data-dismiss="modal">
</div>
@ -693,5 +659,4 @@
</div>
{% include 'admin/includes/photo_form.html' with form=photo_form object=object %}
{% include 'admin/includes/file_form.html' with file_form=file_form object=object %}
{% include 'admin/includes/stat_form.html' with form=stat_form object=object %}
{% endblock %}

@ -1,58 +0,0 @@
<div class="modal hide fade bs-example-modal-lg" id="stat_modal" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="close_stat">&times;</button>
<h3>Добавить год</h3>
</div>
<form method="post" class="form-horizontal" id="stat_form" enctype="multipart/form-data" action="#"> {% csrf_token %}
<div class="modal-body">
<div class="control-group{% if form.year.errors %}error{% endif %}">
<label class="control-label">{{ form.year.label }}:</label>
<div class="controls">{{ form.year }}
<span class="help-inline">{{ form.year.errors }}</span>
</div>
</div>
<div class="control-group{% if form.members.errors %}error{% endif %}">
<label class="control-label">{{ form.members.label }}:</label>
<div class="controls">{{ form.members }}
<span class="help-inline">{{ form.members.errors }}</span>
</div>
</div>
<div class="control-group{% if form.visitors.errors %}error{% endif %}">
<label class="control-label">{{ form.visitors.label }}:</label>
<div class="controls">{{ form.visitors }}
<span class="help-inline">{{ form.visitors.errors }}</span>
</div>
</div>
<div class="control-group{% if form.area.errors %}error{% endif %}">
<label class="control-label">{{ form.area.label }}:</label>
<div class="controls">{{ form.area }}
<span class="help-inline">{{ form.area.errors }}</span>
</div>
</div>
<div class="control-group{% if form.countries_number.errors %}error{% endif %}">
<label class="control-label">{{ form.countries_number.label }}:</label>
<div class="controls">{{ form.countries_number }}
<span class="help-inline">{{ form.countries_number.errors }}</span>
</div>
</div>
{% include 'admin/forms/multilang.html' with field='countries' form=form languages=languages %}
</div>
<div class="modal-footer">
<div class="controls">
<input class="btn btn-primary" type="submit" value="Добавить">
<input type="reset" class="btn" value="Отменить" data-dismiss="modal">
</div>
</div>
</form>
</div>

@ -1,37 +0,0 @@
{% extends 'base.html' %}
{% block body %}
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-arrow-down"></i>Список заказов</h2>
</div>
<div class="box-content">
<table class="table table-hover">
<thead>
<tr>
<th>id</th>
<th>Контактное лицо</th>
<th>Телефон</th>
<th>Время создания</th>
</tr>
</thead>
<tbody>
{% for item in object_list %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.person_inf }}</td>
<td>{{ item.phone }}</td>
<td>{{ item.created }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% include 'admin/includes/admin_pagination.html' with page_obj=page_obj %}
</div>
{# pagination #}
{% endblock %}

@ -19,8 +19,8 @@
{% include 'includes/article/article_logo.html' with obj=object %}
<h1>{{ object.main_title }}</h1>
<strong><span>{{ object.created }}</span><a class="profile_link" href="{{ object.author.get_permanent_url }}" title="">{{ object.author.get_full_name }}</a></strong>
{{ object.description|safe }}
<strong><span>{{ object.publish_date }}</span><a class="profile_link" href="{{ object.author.get_permanent_url }}" title="">{{ object.author.get_full_name }}</a></strong>
{{ object.description }}
<div class="blog_avtor">
<table>

@ -12,7 +12,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Статьи' %}</h1>
<h1>{% trans 'Статьи' %}:</h1>
</div>
{% endblock %}
@ -105,15 +105,11 @@
<h3><a href="{{ blog.get_permanent_url }}" title="">{{ blog.main_title }}</a></h3>
{{ blog.preview }}
<strong><span>{{ blog.created|date:"d E Y" }}</span>{% if blog.tag.all.exists %}{% include 'includes/article_tags.html' with obj=blog %}{% endif %}</strong>
<strong><span>{{ blog.publish_date }}</span>{% include 'includes/article_tags.html' with obj=blog %}</strong>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}
{% block paginator %}
{% include 'includes/catalog_paginator.html' with page_obj=page_obj %}
{% endblock %}

@ -103,14 +103,10 @@
{% include 'includes/article/news_preview.html' with obj=news %}</a>
<h3><a href="{{ news.get_permanent_url }}" title="">{{ news.main_title }}</a></h3>
{{ news.preview }}
<strong><span>{{ news.created|date:"d E Y" }}</span>{% with event=news.get_event %}{% if event %}<a href="{{ event.get_permanent_url }}" title=""><b>{{ event.name }}</b></a>{% endif %}{% endwith %}</strong>
<strong><span>{{ news.publish_date }}</span><a href="{{ news.get_event.get_permanent_url }}" title=""><b>{{ news.get_event }}</b></a></strong>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
{% block paginator %}
{% include 'includes/catalog_paginator.html' with page_obj=page_obj %}
{% endblock %}

@ -1,5 +1,4 @@
{% extends 'base_catalog.html' %}
{% load static %}
{% load template_filters %}
{% load i18n %}
@ -20,39 +19,8 @@
{% block content_list %}
{% include 'client/includes/exposition/statistic.html' with exposition=object %}
<script>
$('a.eps-open').on('click', function () {
var $switch = $(this);
var $sect = $switch.closest('.ep-sect');
var $sectBody = $sect.children('div.ep-sect-body');
if ($sect.hasClass('eps-opened')) {
$sectBody
.stop()
.animate({
height: 'hide',
opacity: 'hide'
}, 300, function () {
$sect.removeClass('eps-opened');
});
} else {
$sectBody
.stop()
.animate({
height: 'show',
opacity: 'show'
}, 300, function () {
$sect.addClass('eps-opened');
});
}
return false;
});
</script>
{% endblock %}
{% block paginator %}
{% endblock %}
{% endblock %}

@ -438,7 +438,7 @@
<div class="add_link_text_text">{% trans 'информацию о себе' %} <b>+10</b></div>
</div>
<div class="p-editable editable-wrap {% if about_form.about.value %}{% else %}hidden{% endif %}">
<p id="static-about-value" class="static-value">{{ about_form.about.value|linebreaks }}</p>
<p id="static-about-value" class="static-value">{{ about_form.about.value }}</p>
<div class="edit-wrap">
<a class="e-btn fa fa-pencil-square-o" href="javascript:void(0);">{% trans 'редактировать' %}</a>

@ -35,7 +35,7 @@
</div>
<div class="i-descr">
{{ member.profile.about_company|safe|linebreaks }}
{{ member.profile.about_company|safe }}
</div>
<hr />

@ -158,8 +158,7 @@
<div class="add_link_text_text">{% trans 'краткое описание компании' %} <b>+20</b></div>
</div>
<div class="i-position p-editable editable-wrap {% if spec_form.specialization %}{% else %}hidden{% endif %} required">
<span id="static-spec-value" class="static-value min-height">{{ spec_form.specialization.value|linebreaks }}&nbsp;</span>
<span id="static-spec-value" class="static-value min-height">{{ spec_form.specialization.value }}&nbsp;</span>
<div class="edit-wrap">
<a class="e-btn fa fa-pencil-square-o" href="javascript:void(0);">{% trans 'редактировать' %}</a>
@ -612,10 +611,8 @@
</dl>
<!-- !!! -->
</div>
<a rel="nofollow" id="profile-preview-btn" class="button profile-preview-btn" href="javascript:void(0);" target="_blank">Предварительный просмотр <i class="fa fa-eye"></i></a>
</div>
</div>
</div>
@ -651,6 +648,7 @@
avatarImageClass:'user-avatar',
avatarInputId:"id_avatar",
noImageSrc:"{% static 'client/img/no-logo.png' %}",
previewBtnId:"profile-preview-btn",
// text and paths for dynamically rendered selectboxes
selectBox:[

@ -22,7 +22,9 @@
<div class="i-title">{{ company.name|safe }}</div>
</header>
<div class="i-area"><a href="#">{{ company.specialization|linebreaks }}</a></div>
<div class="i-area specialization">
{{ company.specialization }}
</div>
{% with themes=company.theme.all %}
<div class="i-area" id="theme-inf" data-theme="{% for th in themes %}{{ th.id }},{% endfor %}">
{% for th in themes %}
@ -41,8 +43,11 @@
{% endwith %}
</div>
<hr />
{{ company.address_inf }}
{% if company.address_inf %}
<hr />
{{ company.address_inf }}
{% endif %}
<hr />
@ -121,16 +126,25 @@
</div>
</div>
<hr />
<div class="i-statistics">
{% if company.get_expositions_number > 0 or company.get_conferences_number > 0 or company.get_seminars_number > 0 %}
<hr />
<div class="i-statistics">
<header class="clearfix">
<div class="ish-title">{% trans 'Участие в событиях' %}</div>
<div class="ish-data">
<span><a href="/expositions/member-{{ company.url }}"><b>{{ company.get_expositions_number }}</b> в&nbsp;{% trans 'выставках' %}</a></span>
<span><a href="/conferences/member-{{ company.url }}"><b>{{ company.get_conferences_number }}</b> в&nbsp;{% trans 'конференциях' %}</a></span>
<span><a href="/seminars/member-{{ company.url }}"><b>{{ company.get_seminars_number }}</b> в&nbsp;{% trans 'семинарах' %}</a></span>
</div>
{% if company.get_expositions_number > 0 %}
<span><a href="/expositions/member-{{ company.url }}"><b>{{ company.get_expositions_number }}</b> в&nbsp;{% trans 'выставках' %}</a></span>
{% endif %}
{% if company.get_conferences_number > 0 %}
<span><a href="/conferences/member-{{ company.url }}"><b>{{ company.get_conferences_number }}</b> в&nbsp;{% trans 'конференциях' %}</a></span>
{% endif %}
{% if company.get_seminars_number > 0 %}
<span><a href="/seminars/member-{{ company.url }}"><b>{{ company.get_seminars_number }}</b> в&nbsp;{% trans 'семинарах' %}</a></span>
{% endif %}
</div>
</header>
<ul class="cat-list cl-exhibitions">
@ -179,6 +193,7 @@
<a class="button more" href="/expositions/member-{{ company.url }}">{% trans 'Все события' %}</a>
{% endif %}
</div>
{% endif %}
<hr />
<div class="i-staff">
<div class="sect-title"><a href="#">{% trans 'Сотрудники' %}</a></div>

@ -1,5 +1,4 @@
{% load i18n %}
{% load template_filters %}
<div class="m-article">
<div class="item-wrap event clearfix">
@ -86,12 +85,12 @@
</div>
<div class="eps-item">
<b>{{ st.members }}</b>
<div class="eps-text">{% trans 'участников' %}</div>
<div class="eps-text">{% trans 'учасников' %}</div>
</div>
</div>
<div class="ep-info clearfix">
{% if st.area %}
{% if exposition.place %}
<div class="ep-area-wrap">
<div class="epa-title">{% trans 'Общая выставочная площадь' %}</div>
@ -102,26 +101,39 @@
<div class="ep-founded"><b>{{ exposition.foundation_year }}</b> год основания</div>
</div>
{% if st.countries_number or st.countries %}
<!--
<div class="ep-countries clearfix">
<div class="epc-title">{% trans 'Страны' %}</div>
<div class="epc-list">
{% if st.countries_number %}
<ul>
<li>{{ st.countries_number }} {% trans 'стран-участниц' %}</li>
<li>Австралия</li>
<li>Австрия</li>
<li>Азербайджан</li>
<li>Албания</li>
<li>Алжир</li>
<li>Ангола</li>
</ul>
{% else %}
{% with html=st.countries|generate_countries_list %}
{{ html|safe }}
{% endwith %}
{% endif %}
<ul>
<li>Андорра</li>
<li>Антигуа</li>
<li>Аргентина</li>
<li>Армения</li>
<li>Афганистан</li>
<li>Багамские острова</li>
</ul>
<ul>
<li>Бангладеш</li>
<li>Барбадос</li>
<li>Бахрейн</li>
<li>Белиз</li>
</ul>
</div>
</div>
{% endif %}
-->
</div>

@ -12,12 +12,12 @@
<form class="pw-form" id="callback-form" action="/callback/">
<div class="pwf-line">
<div class="pwf-field">
<input type="text" placeholder="Контактное лицо" name="person_inf" id="id_person_inf">
<input type="text" placeholder="Контактное лицо" name="callback_name" id="id_callback_name">
</div>
</div>
<div class="pwf-line">
<div class="pwf-field">
<input type="text" placeholder="Контактный номер телефона" name="phone" id="id_phone">
<input type="text" placeholder="Контактный номер телефона" name="callback_phone" id="id_callback_phone">
</div>
</div>
<div class="pwf-buttons-line">

@ -11,8 +11,7 @@ def get_tag(request):
qs = Tag.objects.language().filter(theme__id__in=themes).order_by('translations__name').distinct()
else:
qs = Tag.objects.language().filter(theme__id__in=themes, translations__name__contains=term).distinct()
result = [{'id': tag.id, 'label': '%s (%s)'%(tag.name, tag.theme.name)} for tag in qs]
result = sorted(result, key=lambda x:x['label'])
result = [{'id': tag.id, 'label': tag.name} for tag in qs]
return HttpResponse(json.dumps(result), content_type='application/json')
#else:

Loading…
Cancel
Save