Merge branch 'develop' of gitlab.com:OldminTeam/expomap into develop

remotes/origin/HEAD
avgoeid 9 years ago
commit e1fb6f431d
  1. 2
      Makefile
  2. 50
      apps/accounts/admin.py
  3. 2
      apps/accounts/admin_urls.py
  4. 45
      apps/accounts/forms.py
  5. 17
      apps/accounts/models.py
  6. 4
      apps/accounts/urls.py
  7. 26
      apps/accounts/views.py
  8. 114
      apps/article/admin.py
  9. 152
      apps/article/forms.py
  10. 55
      apps/article/models.py
  11. 8
      apps/city/admin.py
  12. 3
      apps/city/urls.py
  13. 11
      apps/city/views.py
  14. 17
      apps/company/admin.py
  15. 7
      apps/company/admin_urls.py
  16. 6
      apps/company/signals.py
  17. 42
      apps/core/forms.py
  18. 8
      apps/core/simple_index_view.py
  19. 27
      apps/core/utils.py
  20. 130
      apps/core/views.py
  21. 7
      apps/expobanner/admin.py
  22. 1
      apps/meta/admin.py
  23. 25
      apps/meta/forms.py
  24. 5
      apps/place_conference/models.py
  25. 5
      apps/place_exposition/models.py
  26. 1
      apps/place_exposition/urls.py
  27. 24
      apps/place_exposition/views.py
  28. 3
      apps/theme/admin.py
  29. 7
      apps/theme/forms.py
  30. 80
      apps/theme/migrations/0002_auto__del_field_themetranslation_keywords__del_field_themetranslation_.py
  31. 6
      apps/theme/models.py
  32. 3
      proj/admin.py
  33. 16
      proj/decorators.py
  34. 5
      proj/middleware.py
  35. 6
      proj/views.py
  36. 186
      templates/c_admin/article/article_add.html
  37. 69
      templates/c_admin/article/article_all.html
  38. 2
      templates/c_admin/article/article_confirm_delete.html
  39. 93
      templates/c_admin/article/blog_form.html
  40. 2
      templates/c_admin/expobanner/link_list.html
  41. 1
      templates/c_admin/includes/admin_nav.html
  42. 31
      templates/c_admin/proj/settings.html
  43. 12
      templates/c_admin/theme/theme_add.html
  44. 150
      templates/client/city/city.html
  45. 2
      templates/client/exposition/catalog_theme.html
  46. 2
      templates/client/includes/meta.html
  47. 101
      templates/client/includes/place/place_list.html
  48. 2
      templates/client/place/place_detail.html

@ -41,7 +41,7 @@ compilemessages:
-@ipython manage.py compilemessages
collectstatic:
@ipython manage.py collectstatic --noinput
@ipython manage.py collectstatic
user:
-@ipython manage.py createsuperuser

@ -20,8 +20,6 @@ from django.views.generic import DeleteView, TemplateView, UpdateView
from django.views.generic.dates import DateMixin, MonthMixin, YearMixin
from forms import (
ChangePasswordForm,
EmailAnnouncementForm,
UserCreationForm,
UserFilterForm,
UserForm
)
@ -55,13 +53,6 @@ class UserListView(AdminListView):
return context
class EditUser(UpdateView):
model = User
form_class = UserForm
success_url = '/admin/accounts/all'
template_name = 'user_change.html'
def user_change(request, url):
"""
Return form of user and post it on the server.
@ -116,47 +107,6 @@ def user_change(request, url):
return render_to_response('user_change.html', context)
def create_admin(request):
if request.POST:
form = UserCreationForm(request.POST)
if form.is_valid():
user = form.save(commit=False)
user.is_admin = False
user.save()
return HttpResponseRedirect('/admin/accounts/all')
else:
form = UserCreationForm()
args = {}
args.update(csrf(request))
args['form'] = form
return render_to_response('create_admin.html', args)
def create_md5(request):
if request.POST:
form = UserCreationForm(request.POST)
if form.is_valid():
user = User()
user.email = request.POST['email']
user.first_name = request.POST['first_name']
user.last_name = request.POST['last_name']
user.password = md5(request.POST['password2']).hexdigest()
user.is_admin = True
user.save()
return HttpResponseRedirect('/admin/accounts/all')
else:
form = UserCreationForm()
args = {}
args.update(csrf(request))
args['form'] = form
return render_to_response('create_admin.html', args)
def generatePassword():
"""

@ -3,7 +3,7 @@ from django.conf.urls import patterns, url
from django.core.urlresolvers import reverse_lazy
from functions.custom_views import SimpleObjectChangeView
from .admin import AccountsStatistic, DeleteAccount, EditUser, UserListView
from .admin import AccountsStatistic, DeleteAccount, UserListView
from .models import User
attrs = {

@ -29,43 +29,6 @@ def clean_relation_field(inst, field_name, model):
return None
class UserCreationForm(forms.ModelForm):
password1 = forms.CharField(label=_(u'Пароль'), widget=forms.PasswordInput(render_value=False))
password2 = forms.CharField(label=_(u'Повторите пароль'), widget=forms.PasswordInput(render_value=False))
class Meta:
model = User
fields = ('email', 'first_name', 'last_name')
def clean_email(self):
"""
checking if user already exist
"""
email = self.cleaned_data.get('email')
try:
User.objects.get(email=email)
except User.DoesNotExist:
return email
raise forms.ValidationError(_(u'Пользователь с таким email уже существует'))
def clean_password2(self):
password1 = self.cleaned_data.get('password1')
password2 = self.cleaned_data.get('password2')
if password1 and password2 and password1 != password2:
raise forms.ValidationError(_(u'Пароли не совпадают'))
return password2
def save(self, commit=True):
user = super(UserCreationForm, self).save(commit=False)
user.set_password(self.cleaned_data['password2'])
if commit:
user.save()
return user
class UserForm(forms.ModelForm):
# email = forms.EmailField(widget=forms.TextInput(attrs={'disabled' : True}), required=False)
country = forms.ChoiceField(label=_(u'Страна'), choices=[(item.id, item.name) for item in Country.objects.language().all()],
@ -196,14 +159,6 @@ class ChangePasswordForm(forms.Form):
return data
class EmailAnnouncementForm(forms.Form):
data = [(1, _(u'Получать приглашения, сообщения и другую корреспонденцию от пользователей Expomap')),
(2, _(u'Получать обзор событий')),
(3, _(u'Получать новости'))]
announcement = forms.MultipleChoiceField(choices=data, widget=forms.CheckboxSelectMultiple())
url_regex = re.compile('^\w*$')
class RegistrationCompleteForm(forms.ModelForm):
country = forms.ModelChoiceField(label=_(u'Страна'), queryset=Country.objects.all(),

@ -11,6 +11,7 @@ from django.db.models.loading import get_model
from django.db.models.signals import post_save
from django.utils import timezone
from django.utils.translation import ugettext as _
from functions.form_check import translit_with_separator
from functions.model_mixin import GetURLorPK
@ -140,16 +141,12 @@ class User(AbstractBaseUser, PermissionsMixin, GetURLorPK):
log = UserLog.objects.filter(user_id=self.pk)[0]
return log
def get_full_name(self):
"""
Returns the first_name plus the last_name, with a space in between.
"""
return u'%s %s'%(self.first_name, self.last_name)
def set_url(self, st):
self.url = translit_with_separator(u'%s'%st)
def __unicode__(self):
return self.email
@ -166,9 +163,6 @@ class User(AbstractBaseUser, PermissionsMixin, GetURLorPK):
def has_perm(self, perm, obj=None):
return True
def has_module_perms(self, app_label):
return True
def get_expositions_number(self):
# 1 query
return self.exposition_users.all().count()
@ -181,15 +175,6 @@ class User(AbstractBaseUser, PermissionsMixin, GetURLorPK):
# 1 query
return self.seminar_users.all().count()
def get_webinars_number(self):
# 1 query
return self.webinar_users.all().count()
def get_events_number(self):
# 4 query
n = self.get_expositions_number() + self.get_conferences_number() + self.get_seminars_number() + self.get_webinars_number()
return n
def get_permanent_url(self):
if self.url:
return '/%s/' % self.url

@ -9,7 +9,6 @@ from views import (
Feed,
HomeView,
MailingSettings,
# MailingSettingsUnsubscribe,
NameView,
PhoneView,
ProfileCompanyView,
@ -21,8 +20,7 @@ from views import (
urlpatterns = patterns('',
url(r'^profile/company/$', login_required(ProfileCompanyView.as_view())),
url(r'^profile/mailing/$', MailingSettings.as_view(), name='accounts-mailing_settings'),
# url(r'^profile/mailing/unsubscribe/$', MailingSettingsUnsubscribe.as_view(), name='accounts-mailing_settings_unsubscribe'),
url(r'^profile/mailing/$', login_required(MailingSettings.as_view()), name='accounts-mailing_settings'),
url(r'^profile/settings/$', login_required(SettingsView.as_view()), name='accounts_settings'),
url(r'^profile/calendar/remove/$', 'accounts.views.remove_from_calendar'),
url(r'^profile/calendar/export/$', 'core.views.download_workbook'),

@ -29,7 +29,7 @@ from company.edit_forms import NameForm as CompNameForm, HomeForm as CompHomeFor
from emencia.django.newsletter.forms import SubscribeSettingsForm, MailingSettingsForm
from emencia.django.newsletter.models import Contact, ContactSettings
from .forms import ChangePasswordForm, EmailAnnouncementForm, FeedFilterForm
from .forms import ChangePasswordForm, FeedFilterForm
from .models import User
from .edit_forms import AvatarForm, NameForm, HomeForm, WorkForm, AboutCompanyForm, PhoneForm, EmailForm,\
WebPageForm, SocialForm, AboutForm
@ -135,13 +135,11 @@ class MailingSettings(GetUserMixin, ContextMixin, AjaxableResponseMixin, CreateU
'checked_th': list(instance.themes.values_list('pk', flat=True)),
'contact': instance,
})
elif not self.request.user.is_authenticated():
raise HttpResponseForbidden()
if self.request.GET.get('unsibscribe') and instance.subscriber:
instance.unsubscribe()
self.extra_ctx.update({'unsubscribe_success': True})
elif not instance.subscriber:
self.extra_ctx.update({'unsubscribed': True})
if self.request.GET.get('unsibscribe') and instance.subscriber:
instance.unsubscribe()
self.extra_ctx.update({'unsubscribe_success': True})
elif not instance.subscriber:
self.extra_ctx.update({'unsubscribed': True})
return instance
def form_valid(self, form):
@ -157,18 +155,6 @@ class MailingSettings(GetUserMixin, ContextMixin, AjaxableResponseMixin, CreateU
# print(self.request.POST)
return super(MailingSettings, self).form_invalid(form)
#
# class MailingSettingsUnsubscribe(GetUserMixin, RedirectView):
# url = reverse_lazy('accounts-mailing_settings')
#
# def get(self, request, *args, **kwargs):
# contact = self.get_user()
# if contact is None:
# return HttpResponseForbidden()
# if contact.subscriber:
# contact.unsubscribe()
# return super(MailingSettingsUnsubscribe, self).get(request, *args, **kwargs)
class CalendarView(TemplateView):
"""

@ -14,7 +14,7 @@ from ckeditor.widgets import CKEditorWidget
from sorl.thumbnail.admin.current import AdminImageWidget
#models and forms
from .forms import ArticleForm, ArticleDeleteForm, NewsForm
from .forms import NewsForm
from .models import Article, Author
from theme.models import Tag
@ -48,101 +48,6 @@ class ArticleDeleteView(DeleteView):
return "/admin/article/%s/all/" % type
def article_all(request):
"""
Return list of all articles with pagination
"""
return objects_list(request, Article, 'article_all.html')
@login_required
def article_copy(request, url):
article = Article.objects.safe_get(slug=url)
if not article:
return HttpResponseRedirect(get_referer(request))
else:
article.clone()
return HttpResponseRedirect(get_referer(request))
def article_add(request):
"""
Return form of article and post it on the server.
If form is posted redirect on the page of all articles.
"""
#get organiser from current user
init_data = {'author':request.user.organiser}
#choices field which will be filled by ajax
choices = {'tag': Tag}
return add_object_with_file(request, ArticleForm, 'article_add.html', '/admin/article/all',
choices, init_data)
def article_delete(request, url):
return delete_object(request, Article, ArticleDeleteForm, url, '/admin/article/all')
@login_required
def article_change(request, url):
"""
Return form and fill it with existing Article object data.
If form is posted redirect on the page of all articles.
"""
try:
#check if article_id exists else redirect to the list of cities
article = Article.objects.get(slug=url)
file_form = FileModelForm(initial={'model': 'article.Article'})
article_id = getattr(article, 'id')
except:
return HttpResponseRedirect('/admin/article/all')
if request.POST:
form = ArticleForm(request.POST)
#set choices filled by ajax
form.fields['tag'].choices = [(item.id, item.name) for item in Tag.objects.all()]
if form.is_valid():
form.save(getattr(article, 'id'))
return HttpResponseRedirect('/admin/article/all')
else:
data = {}
#fill form with data from database
data['author'] = article.author
data['theme'] = [item.id for item in article.theme.all()]
data['tag'] = [item.id for item in article.tag.all()]
#hidden field
data['article_id'] = article_id
#data from translated fields
for code, name in settings.LANGUAGES:
obj = Article._meta.translations_model.objects.get(language_code = code,master__id=getattr(article, 'id')) #access to translated fields
data['main_title_%s' % code] = obj.main_title
data['preview_%s' % code] = obj.preview
data['description_%s' % code] = obj.description
data['title_%s' % code] = obj.title
data['keywords_%s' % code] = obj.keywords
data['descriptions_%s' % code] = obj.descriptions
#fill form
form = ArticleForm(initial=data)
#set choices filled by ajax
form.fields['tag'].choices = [(item.id, item.name) for item in Tag.objects.filter(theme__in=data['theme'])]
args = {}
args.update(csrf(request))
args['form'] = form
args['languages'] = settings.LANGUAGES
args['file_form'] = file_form
#get list of files which connected with specific model object
args['files'] = FileModel.objects.filter(content_type=ContentType.objects.get_for_model(article), object_id=getattr(article, 'id'))
args['obj_id'] = getattr(article, 'id')
return render_to_response('article_add.html', args)
#-----------------------
from django.views.generic import FormView
from functions.custom_views import ListView
@ -206,6 +111,7 @@ class BlogView(FormView):
data['main_title_%s' % code] = obj.main_title
data['preview_%s' % code] = obj.preview
data['description_%s' % code] = obj.description
data['short_description_%s' % code] = obj.short_description
data['title_%s' % code] = obj.title
data['keywords_%s' % code] = obj.keywords
data['descriptions_%s' % code] = obj.descriptions
@ -230,7 +136,7 @@ class BlogView(FormView):
class NewsList(ListView):
model = Article
template_name = 'article/article_admin_list.html'
template_name = 'c_admin/article/article_admin_list.html'
paginate_by = 20
def get_queryset(self):
@ -247,17 +153,3 @@ class NewsView(BlogView):
template_name = 'c_admin/article/blog_form.html'
success_url = '/admin/article/news/all/'
obj = None
"""
from django.views.generic import CreateView
from models import Blog
from forms import BlogForm
class BlogCreate(CreateView):
model = Blog
form_class = BlogForm
template_name = 'c_admin/blog/blog_add.html'
"""

@ -116,7 +116,6 @@ class BlogForm(_BlogForm):
return article
class NewsForm(_BlogForm):
type = Article.news
exposition = forms.CharField(label=_(u'Выставка'), widget=forms.HiddenInput(), required=False)
@ -154,157 +153,6 @@ class NewsForm(_BlogForm):
return None
class ArticleForm(forms.Form):
"""
Create Article form for creating conference
__init__ uses for dynamic creates fields
save function saves data in Article object. If it doesnt exist create new object
"""
#users that have organiser profile
author = forms.ModelChoiceField(label=_(u'Автор'),queryset=User.objects.exclude(organiser__isnull=True))
key = forms.CharField(required=False, widget=forms.HiddenInput())
theme = forms.ModelMultipleChoiceField(label=_(u'Тематики'), queryset=Theme.objects.all())
#creates select input with empty choices cause it will be filled with ajax
tag = forms.MultipleChoiceField(label=_(u'Теги'), required=False)
article_id = forms.CharField(required=False, widget=forms.HiddenInput())
def __init__(self, *args, **kwargs):
"""
create dynamical translated fields fields
"""
super(ArticleForm, 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['main_title_%s' % code] = forms.CharField(label=_(u'Заголовок'), required=required)
self.fields['preview_%s' % code] = forms.CharField(label=_(u'Превью'), required=required, widget=CKEditorWidget)
self.fields['description_%s' % code] = forms.CharField(label=_(u'Описание'), required=required, widget=CKEditorWidget)
#meta data
self.fields['title_%s' % code] = forms.CharField(label=_(u'Тайтл'), required=False, max_length=255,
widget=forms.TextInput(attrs={'style':'width: 550px'}))
self.fields['keywords_%s' % code] = forms.CharField(label=_(u'Дескрипшен'), required=False, max_length=255,
widget=forms.TextInput(attrs={'style':'width: 550px'}))
self.fields['descriptions_%s' % code] = forms.CharField(label=_(u'Кейвордс'), required=False, max_length=255,
widget=forms.TextInput(attrs={'style':'width: 550px'}))
def save(self, id=None):
"""
change Article object with id = id
N/A add new Article object
usage: form.save(obj) - if change article
form.save() - if add article
"""
data = self.cleaned_data
#create new Article object or get exists
if not id:
article = Article()
else:
article = Article.objects.get(id=id)
#clear manytomany relations
article.theme.clear()
article.tag.clear()
if data.get('author'):
article.user = User.objects.get(id=data['author'].id)#.id cause select uses queryset
#create slug field from russian language
if not getattr(article, 'slug'):
article.slug = translit_with_separator(data['main_title_ru'].strip()).lower()
# fill translated fields and save object
fill_with_signal(Article, article, data)
# fill manytomany fields
for item in data['theme']:
article.theme.add(item.id)#.id cause select uses queryset
for item in data['tag']:
article.tag.add(item)
article.save()
#save files
check_tmp_files(article, data['key'])
def clean(self):
id = self.cleaned_data.get('article_id')
main_title_ru = self.cleaned_data.get('main_title_ru')
article = Article.objects.filter(url=translit_with_separator(main_title_ru))
if article and str(article[0].id) != id:
msg = _(u'Статья с таким названием уже существует')
self._errors['main_title_ru'] = ErrorList([msg])
del self.cleaned_data['main_title_ru']
return self.cleaned_data
class ArticleDeleteForm(forms.ModelForm):
url = forms.CharField(widget=forms.HiddenInput())
class Meta:
model = Article
fields = ('url',)
#----------------------------------
"""
from models import Blog
class BlogForm(forms.ModelForm):
class Meta:
model = Blog
exclude = ('created', 'modified', 'creator', 'theme', 'tag')
def __init__(self, *args, **kwargs):
super(BlogForm, self).__init__(*args, **kwargs)
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['main_title_%s' % code] = forms.CharField(label='Заголовок', required=required)
self.fields['preview_%s' % code] = forms.CharField(label='Превью', required=required, widget=CKEditorWidget)
self.fields['description_%s' % code] = forms.CharField(label='Описание', required=required, widget=CKEditorWidget)
#meta data
self.fields['title_%s' % code] = forms.CharField(label='Тайтл', required=False, max_length=255,
widget=forms.TextInput(attrs={'style':'width: 550px'}))
self.fields['keywords_%s' % code] = forms.CharField(label='Дескрипшен', required=False, max_length=255,
widget=forms.TextInput(attrs={'style':'width: 550px'}))
self.fields['descriptions_%s' % code] = forms.CharField(label='Кейвордс', required=False, max_length=255,
widget=forms.TextInput(attrs={'style':'width: 550px'}))
"""
class ArticleFilterForm(forms.Form):
theme = forms.MultipleChoiceField(label=_(u'Тематика:'), required=False,
choices=[(item.id, item.name) for item in Theme.objects.language().distinct()])
tag = forms.CharField(label=_(u'Теги:'), widget=forms.HiddenInput(), required=False)
'''
def __init__(self, *args, **kwargs):
"""
create dynamical translated fields fields
"""
super(ArticleFilterForm, self).__init__(*args, **kwargs)
ids = [item['theme_id'] for item in list(Article.objects.blogs().values('theme_id').distinct())]
self.fields['theme'] = forms.MultipleChoiceField(label=_(u'Тематика:'), required=False,
choices=[(item.id, item.name) for item in Theme.objects.language().filter(id__in=ids)])
'''
class BlogFilterForm(forms.Form):
tag = forms.CharField(label=_(u'Теги:'), widget=forms.HiddenInput(), required=False)

@ -107,21 +107,6 @@ class Article(TranslatableModel):
def __unicode__(self):
return self.lazy_translation_getter('main_title', self.pk)
def translation_model(self):
return self._meta.translations_model
def publish(self):
"""
set publish date. uses when publish date is none
"""
self.in_sitemap = True
if not self.publish_date:
# save time only first time
self.publish_date = now()
self.save()
return self
def get_event(self):
"""
get event connected to article
@ -137,17 +122,8 @@ class Article(TranslatableModel):
# If no slug is provided, generates one before saving.
if not self.slug:
self.slug = self.generate_unique_slug()
# Set the description field on save.
# if self.gen_description:
# self.description = strip_tags(self.description_from_content())
super(Article, self).save(*args, **kwargs)
def description_from_content(self):
"""
"""
# place for logic
return ''
def generate_unique_slug(self):
"""
Create a unique slug by passing the result of get_slug() to
@ -173,37 +149,6 @@ class Article(TranslatableModel):
"""
return u'%s' % self.lazy_translation_getter('main_title', self.pk)
def _get_next_or_previous_by_publish_date(self, is_next, **kwargs):
"""
Retrieves next or previous object by publish date. We implement
our own version instead of Django's so we can hook into the
published manager and concrete subclasses.
"""
arg = "publish_date__gt" if is_next else "publish_date__lt"
order = "publish_date" if is_next else "-publish_date"
lookup = {arg: self.publish_date}
concrete_model = base_concrete_model(Article, self)
try:
queryset = concrete_model.objects.published
except AttributeError:
queryset = concrete_model.objects.all
try:
return queryset(**kwargs).filter(**lookup).order_by(order)[0]
except IndexError:
pass
def get_next_by_publish_date(self, **kwargs):
"""
Retrieves next object by publish date.
"""
return self._get_next_or_previous_by_publish_date(True, **kwargs)
def get_previous_by_publish_date(self, **kwargs):
"""
Retrieves previous object by publish date.
"""
return self._get_next_or_previous_by_publish_date(False, **kwargs)
def admin_url(self):
"""
returns url for admin pages

@ -21,13 +21,6 @@ from functions.admin_views import AdminListView
from functions.http import JsonResponse
def city_all(request):
"""
return list of all cities with pagination
"""
return objects_list(request, City, 'city_all.html')
def city_add(request):
"""
Return form of city and post it on the server.
@ -35,6 +28,7 @@ def city_add(request):
"""
return add_object_with_file(request, CityForm, 'city_add.html', '/admin/city/all')
def city_delete(request, url):
return delete_object(request, City, CityDeleteForm, url, '/admin/city/all/')

@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from views import CityView
urlpatterns = patterns('',
url(r'get-city/', 'city.views.get_city'),
# commented for good times
#url(r'(?P<slug>.*)', CityView.as_view()),
)

@ -7,15 +7,6 @@ from models import City
from settings.views import get_by_lang
class CityView(DetailView):
"""
this view is not used yet
"""
model = City
slug_field = 'url'
template_name = 'client/city/city.html'
def get_city(request):
"""
returns filtered cities in current language in json format
@ -39,4 +30,4 @@ def get_city(request):
return HttpResponse(json.dumps(result, indent=4), content_type='application/json')
else:
return HttpResponse('not ajax')
return HttpResponse('not ajax')

@ -19,23 +19,6 @@ from theme.models import Tag
from django.utils.translation import ugettext_lazy as _
def company_all(request):
"""
Return list of all companies with pagination
"""
return objects_list(request, Company, 'company_all.html')
def company_add(request):
"""
Return form of company and post it on the server.
If form is posted redirect on the page of all companies.
"""
return add_object_with_file(request, CompanyForm,
'company_add.html', '/admin/company/all/',
{'city': City, 'tag': Tag})
def company_delete(request, url):
return delete_object(request, Company,
CompanyDeleteForm, url, '/admin/company/all')

@ -27,11 +27,4 @@ urlpatterns = patterns('company.admin',
url(r'^(?P<url>.*)/$', CompanyView.as_view()),
url(r'^$', CompanyView.as_view()),
# url(r'^add.*/$', 'company_add'),
# url(r'^delete/(?P<url>.*)/$', 'company_delete'),
# url(r'^change/(?P<url>.*)/$', 'company_change'),
# url(r'^all/$', 'company_all'),
# url(r'^all/$', CompanyListView.as_view()),
)

@ -1,6 +0,0 @@
# -*- coding: utf-8 -*-
from django.db.models.signals import post_save
from models import Company
from functions.signal_handlers import post_save_handler
#post_save.connect(post_save_handler, sender=Company)

@ -10,48 +10,6 @@ from haystack.query import SearchQuerySet, EmptySearchQuerySet
from hvad.forms import TranslatableModelForm
from models import Page
class PlaceSearchForm(forms.Form):
q = forms.CharField(label=_(u'Поиск'), required=False)
w = forms.CharField(label=_(u'Где'), required=False)
def search(self):
q = self.cleaned_data.get('q')
w = self.cleaned_data.get('w')
if not q and not w:
return EmptySearchQuerySet()
sqs = SearchQuerySet().models(PlaceExposition, PlaceConference)
if q:
sqs = sqs.auto_query(q)
if w:
sqs = sqs.filter(where__contains=w)
return sqs
class CallbackForm(forms.Form):
callback_phone = forms.CharField()
def clean_callback_phone(self):
phone = self.cleaned_data['callback_phone']
phone_str = self.cleaned_data['callback_phone']
deduct = ('-','(',')','.',' ')
for elem in deduct:
phone = phone.replace(elem, '')
if phone.isdigit():
return phone_str
else:
raise forms.ValidationError(_(u'Введите правильный телефон'))
def send(self):
phone = self.cleaned_data['callback_phone']
send_mail(phone, phone, None, [settings.CALLBACK_EMAIL])
# ------------------ Page Form -----------------------
from django.conf import settings
from django.forms import Textarea
from ckeditor.widgets import CKEditorWidget

@ -13,11 +13,11 @@ from settings.models import LandingComment, ParticipationComment
class AdvertisingView(MetadataMixin, TemplateView):
template_name = 'simple_pages/advertising.html'
template_name = 'client/simple_pages/advertising.html'
class AdvertisingViewLanding(JitterCacheMixin, AdvertisingView):
template_name = 'simple_pages/advertising_landing.html'
template_name = 'client/simple_pages/advertising_landing.html'
def get_context_data(self, **kwargs):
context = super(AdvertisingViewLanding, self).get_context_data(**kwargs)
@ -26,7 +26,7 @@ class AdvertisingViewLanding(JitterCacheMixin, AdvertisingView):
class ParticipationViewLanding(JitterCacheMixin, MetadataMixin, FormView):
template_name = 'simple_pages/participation_landing.html'
template_name = 'client/simple_pages/participation_landing.html'
form_class = ParticipationLandingForm
def get_initial(self):
@ -61,7 +61,7 @@ class ParticipationViewLanding(JitterCacheMixin, MetadataMixin, FormView):
class AboutView(MetadataMixin, TemplateView):
template_name = 'simple_pages/about.html'
template_name = 'client/simple_pages/about.html'
def callback(request):

@ -33,33 +33,6 @@ CELL_STYLE_MAP = (
)
def multi_getattr(obj, attr, default=None):
attributes = attr.split(".")
for i in attributes:
try:
obj = getattr(obj, i)
except AttributeError:
if default:
return default
else:
return '-'
return obj
def get_column_cell(obj, name):
try:
attr = multi_getattr(obj, name)
except ObjectDoesNotExist:
return ''
if hasattr(attr, '_meta'):
# A Django Model (related object)
return unicode(attr).strip()
elif hasattr(attr, 'all'):
# A Django queryset (ManyRelatedManager)
return ', '.join(unicode(x).strip() for x in attr.all())
return attr
def queryset_to_workbook(queryset, columns, report_date = None):
# localization

@ -9,136 +9,6 @@ from django.core.urlresolvers import reverse_lazy
from functions.views_help import split_params
from django.utils.translation import ugettext as _
class PlaceListView(ListView):
paginate_by = 10
params = None
single_page = False
template_name = 'place_catalog_test.html'
model = 'places'
order = 'data_begin'
def get_params(self):
model_names = {'places': _(u'Места')}
model_alternative_name = {'places': 'place'}
params = [{'type':'model', 'url':self.model, 'name': model_names.get(self.model),
'alternative_name': model_alternative_name.get(self.model)}]
st = self.kwargs.get('params')
if st:
params = params + split_params(st)
return params
def get_queryset(self):
pl_ex = PlaceExposition.objects.all()
pl_conf = PlaceConference.objects.all()
params = self.get_params()
for param in params:
if param.get('type') == 'country':
country = Country.objects.safe_get(url=param.get('url'))
if country:
param['name'] = country.name
pl_ex = pl_ex.filter(country=country)
pl_conf = pl_conf.filter(country=country)
if param.get('type') == 'city':
city = City.objects.safe_get(url=param.get('url'))
if city:
param['name'] = city.name
pl_ex = pl_ex.filter(city=city)
pl_conf = pl_conf.filter(city=city)
if param.get('type') == 'place':
pl_ex = pl_ex.filter(url=param.get('url'))
if pl_ex:
query = pl_ex
else:
query = pl_conf.filter(url=param.get('url'))
self.single_page = True
if query:
param['name'] = query[0].name
#if self.request:
# views = query[0].views
# query.update(views=views+1)
self.params = params
return query
self.params = params
return list(pl_ex) + list(pl_conf)
def get_context_data(self, **kwargs):
context = super(PlaceListView, self).get_context_data(**kwargs)
context['filter'] = self.params
context['single_page'] = self.single_page
context['search_form'] = self.search_form
context['search_action'] = '/places/search/'
context['type'] = 'places search'
return context
class PlacePhotoView(PlaceListView):
paginate_by = 12
template_name = 'place/place_photo.html'
obj = None
def get_queryset(self):
pl_ex = PlaceExposition.objects.all()
pl_conf = PlaceConference.objects.all()
params = self.get_params()
for param in params:
if param.get('type') == 'country':
country = Country.objects.safe_get(url=param.get('url'))
if country:
param['name'] = country.name
pl_ex = pl_ex.filter(country=country)
pl_conf = pl_conf.filter(country=country)
if param.get('type') == 'city':
city = City.objects.safe_get(url=param.get('url'))
if city:
param['name'] = city.name
pl_ex = pl_ex.filter(city=city)
pl_conf = pl_conf.filter(city=city)
if param.get('type') == 'place':
pl_ex = pl_ex.filter(url=param.get('url'))
if pl_ex:
query = pl_ex
else:
query = pl_conf.filter(url=param.get('url'))
self.single_page = True
if query:
param['name'] = query[0].name
#if self.request:
# views = query[0].views
# query.update(views=views+1)
params.append({'type':'photo', 'name':_(u'Фото')})
self.params = params
self.obj = query[0]
return query[0].photogallery.photos.all()
self.params = params
return list(pl_ex) + list(pl_conf)
def get_context_data(self, **kwargs):
context = super(PlacePhotoView, self).get_context_data(**kwargs)
context['object'] = self.obj
return context
# --------------------- Page views ------------------------
from forms import PageForm
from models import Page

@ -125,14 +125,9 @@ class BannerList(AbstractList):
class LinkList(AbstractList):
model = Banner
verbose = _(u'Список ссылок')
template_name = 'c_admin/expobanner/link_list.html'
def get_queryset(self):
qs = super(LinkList, self).get_queryset()
qs = qs.filter(link=True).order_by('-created_at')
return qs
queryset = Banner.objects.filter(link=True).order_by('-created_at')
class CustomerList(AbstractList):

@ -13,6 +13,7 @@ class MetaListView(AdminListView):
form_class = MetaFilterForm
model = MetaSetting
class MetaView(AdminView):
form_class = MetaForm
model = MetaSetting

@ -48,8 +48,31 @@ class MetaForm(forms.Form):
meta.save()
class MetaFilterForm(AdminFilterForm):
class MetaFilterForm(forms.Form):
model = MetaSetting
exact_name = forms.CharField(label=_(u'Название'), required=False)
name = forms.CharField(label=_(u'Часть названия'), required=False)
def filter(self):
"""
return filtered queryset
form must be cleaned before calling this method
"""
model = self.model
data = self.cleaned_data
name = data['name']
exact_name = data['exact_name']
if exact_name:
qs = model.objects.filter(translations__title=name).distinct()
return qs
qs = model.objects.all()
if name:
qs = qs.filter(translations__title__icontains=name).distinct()
return qs
class SeoTextForm(TranslatableModelForm):

@ -2,6 +2,7 @@
from django.db import models
from django.contrib.contenttypes import generic
from django.db.models.signals import post_save, pre_save
from django.utils import timezone
from hvad.models import TranslatableModel, TranslatedFields, TranslationManager
from functions.custom_fields import EnumField
from functions.custom_fields import LocationField
@ -107,8 +108,8 @@ class PlaceConference(TranslatableModel, ExpoMixin):
return '/places'
def get_events_number(self):
exp = Conference.objects.filter(place=self)
return len(exp)
return Conference.objects.filter(place=self,
data_begin__gt=timezone.now()).count()
def events(self):
events = Conference.objects.filter(place=self)[:6]

@ -4,6 +4,7 @@ from django.db.models import Q
from django.contrib.contenttypes import generic
from django.db.models.signals import post_save, pre_save
from django.utils.translation import ugettext as _
from django.utils import timezone
from functools import partial
from django.conf import settings
from django.core.urlresolvers import reverse
@ -255,8 +256,8 @@ class PlaceExposition(TranslatableModel, ExpoMixin):
return duplicate
def get_events_number(self):
exp = Exposition.objects.filter(place=self)
return len(exp)
return Exposition.objects.filter(place=self,
data_begin__gt=timezone.now()).count()
class Hall(TranslatableModel):

@ -45,6 +45,7 @@ urlpatterns = patterns(
url(
r'^(?P<slug>.*)/expositions/$',
PlaceExpositionListView.as_view(),
{'meta_id': 94},
name='place_exposition_list'
),
url(

@ -10,11 +10,12 @@ from django.template import RequestContext
from django.utils import translation
from django.utils.translation import ugettext as _
from django.views.generic import DetailView, FormView
from django.utils import timezone
from functions.cache_mixin import CacheMixin, JitterCacheMixin
from functions.custom_views import ListView
from meta.views import MetadataMixin
from place_conference.models import PlaceConference
from exposition.models import Exposition
from .models import PlaceExposition
@ -131,15 +132,12 @@ class PlaceList(JitterCacheMixin, MetadataMixin, ListView):
paginate_by = settings.CLIENT_PAGINATION
template_name = 'client/place/place_list.html'
def get_queryset(self):
#qs = super(PlaceList, self).get_queryset().order_by('-rating')
qs= PlaceExposition.objects.language().select_related('country', 'city').all().order_by('-rating')
conf_qs = PlaceConference.objects.language().all()
qs = PlaceExposition.objects.language().select_related('country', 'city').order_by('-rating')
conf_qs = PlaceConference.objects.language().select_related('country', 'city')
return list(qs)+list(conf_qs)
class PlaceCatalogBy(JitterCacheMixin, MetadataMixin, ListView):
cache_range = [60*30, 60*60]
template_name = 'client/place/catalog_by.html'
@ -232,20 +230,28 @@ class PlaceCityCatalog(PlaceCatalog):
return context
class PlaceExpositionListView(ListView):
class PlaceExpositionListView(MetadataMixin, ListView):
"""
Представление перечня событий относительно места.
Переход на эту страницу происходит со страницы подробного просмотра
места, по ссылке "Все события"
"""
template_name = 'client/place/place_exposition_list.html'
# cache_range = settings.CACHE_RANGE
def get_object(self):
slug = self.kwargs.get('slug')
return get_object_or_404(PlaceExposition, url=slug)
self.object = get_object_or_404(PlaceExposition, url=slug)
return self.object
def get_queryset(self):
return self.get_object().exposition_place.all()
return Exposition.objects.filter(
place=self.get_object(), data_begin__gte=timezone.now()
).select_related(
'country', 'city'
).prefetch_related(
'tag'
)
def get_context_data(self, **kwargs):
ctx = super(PlaceExpositionListView, self).get_context_data(**kwargs)

@ -95,9 +95,6 @@ def theme_change(request, theme_id=None):
data['name_%s'%code] = obj.name
data['description_%s'%code] = obj.description
data['main_title_%s'%code] = obj.main_title
data['title_%s'%code] = obj.title
data['keywords_%s'%code] = obj.keywords
data['descriptions_%s'%code] = obj.descriptions

@ -30,13 +30,6 @@ class ThemeForm(forms.Form):
self.fields['name_%s' % code] = forms.CharField(label=_(u'Название'), required=required)
self.fields['main_title_%s' % code] = forms.CharField(label=_(u'Заголовок'), required=required)
self.fields['description_%s' % code] = forms.CharField(label=_(u'Описание'), required=False, widget=CKEditorWidget)#with saving form
#meta data
self.fields['title_%s' % code] = forms.CharField(label=_(u'Тайтл'), required=False, max_length=255,
widget=forms.TextInput(attrs={'style':'width: 550px'}))
self.fields['keywords_%s' % code] = forms.CharField(label=_(u'Description'), required=False, max_length=255,
widget=forms.TextInput(attrs={'style':'width: 550px'}))
self.fields['descriptions_%s' % code] = forms.CharField(label=_(u'Keywords'), required=False, max_length=255,
widget=forms.TextInput(attrs={'style':'width: 550px'}))
def save(self, id=None):
data = self.cleaned_data

@ -0,0 +1,80 @@
# -*- 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):
# Deleting field 'ThemeTranslation.keywords'
db.delete_column(u'theme_theme_translation', 'keywords')
# Deleting field 'ThemeTranslation.title'
db.delete_column(u'theme_theme_translation', 'title')
# Deleting field 'ThemeTranslation.descriptions'
db.delete_column(u'theme_theme_translation', 'descriptions')
def backwards(self, orm):
# Adding field 'ThemeTranslation.keywords'
db.add_column(u'theme_theme_translation', 'keywords',
self.gf('django.db.models.fields.CharField')(default='', max_length=255, blank=True),
keep_default=False)
# Adding field 'ThemeTranslation.title'
db.add_column(u'theme_theme_translation', 'title',
self.gf('django.db.models.fields.CharField')(default='', max_length=255, blank=True),
keep_default=False)
# Adding field 'ThemeTranslation.descriptions'
db.add_column(u'theme_theme_translation', 'descriptions',
self.gf('django.db.models.fields.CharField')(default='', max_length=255, blank=True),
keep_default=False)
models = {
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.tagtranslation': {
'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'TagTranslation', 'db_table': "u'theme_tag_translation'", 'index_together': '()'},
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'descriptions': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'keywords': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}),
'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
'main_title': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['theme.Tag']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'})
},
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'theme.themetranslation': {
'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'ThemeTranslation', 'db_table': "u'theme_theme_translation'", 'index_together': '()'},
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
'main_title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['theme.Theme']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
}
}
complete_apps = ['theme']

@ -47,11 +47,7 @@ class Theme(TranslatableModel):
translations = TranslatedFields(
name = models.CharField(max_length=255),
main_title = models.CharField(max_length=255),
description = models.TextField(blank=True),
#-----meta data
title = models.CharField(max_length=255, blank=True),
descriptions = models.CharField(max_length=255, blank=True),
keywords = models.CharField(max_length=255, blank=True),
description = models.TextField(blank=True)
)
main_page_conf = models.PositiveIntegerField(default=0, db_index=True)

@ -28,6 +28,7 @@ def ajax_city(request):
objects = City.objects.language().filter(country=request.GET['id']).order_by('name')
return render_to_response('select.html', {'objects': objects})
def ajax_tag(request):
"""
@ -127,14 +128,12 @@ def ajax_post_stat(request, obj_id=None):
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)

@ -1,16 +0,0 @@
from functools import wraps
from django.template import RequestContext
from django.shortcuts import render_to_response
def render_to(tpl):
def decorator(func):
@wraps(func)
def wrapper(request, *args, **kwargs):
out = func(request, *args, **kwargs)
if isinstance(out, dict):
out = render_to_response(tpl, out, RequestContext(request))
return out
return wrapper
return decorator

@ -52,8 +52,6 @@ class Referer(object):
for key, val in data_exists.iteritems():
if val:
if key == 'search':
print(request.session.get('search', []))
print(request.session.get('search', []))[-2:]
search = request.session.get('search', [])[-2:]
search.append(val)
request.session['search'] = search
@ -112,9 +110,6 @@ def check_places(slug):
# https://gist.github.com/b1/3155460
""" spaceless middleware
MIDDLEWARE_CLASSES += ('core_utils.middleware.SpacelessMiddleware',)
"""
class SpacelessMiddleware(object):
""" trim spaces between tags if not in DEBUG """
def process_response(self, request, response):

@ -21,12 +21,6 @@ from emencia.django.newsletter.forms import SubscribeAssideForm
from django.db.models.loading import get_model
def clear_slashes(str_):
if str_[0] == r'/':
str_ = str_[1:]
if str_[-1] == r'/':
str_ = str_[:-1]
return str_
def add_seo(request):
url = request.path

@ -1,186 +0,0 @@
{% extends 'base.html' %}
{% load static %}
{# Displays article form #}
{% block scripts %}
<script src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script>
{# selects #}
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/>
<script src="{% static 'js/select/select2.js' %}"></script>
{# ajax #}
<script src="{% static 'custom_js/file_post_ajax.js' %}"></script>
<script src="{% static 'custom_js/select_tag.js' %}"></script>
{% endblock %}
{% block body %}
{# Uses multilang.html template for translated fields #}
<form method="post" class="form-horizontal" name="form2" id="form2"> {% csrf_token %}
<fieldset>
<legend><i class="icon-edit"></i>{% if obj_id %} Изменить {% else %} Добавить {% endif %}статью</legend>
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-pencil"></i> Основная информация</h2>
</div>
<div class="box-content">
{# Hidden input uses for comparing with TmpFile objects #}
{{ form.key }}
{# Hidden input uses in clean method for checking url #}
{{ form.article_id }}
{# main_title #}
{% include 'c_admin/forms/multilang.html' with field='main_title' form=form languages=languages %}
{# theme #}
<div class="control-group {% if form.theme.errors %}error{% endif %}">
<label class="control-label"><b>{{ form.theme.label }}:</b></label>
<div class="controls">
{{ form.theme }}
<span class="help-inline">{{ form.theme.errors }}</span>
</div>
</div>
{# tag #}
<div class="control-group {% if form.tag.errors %}error{% endif %}">
<label class="control-label">{{ form.tag.label }}:</label>
<div class="controls">
{{ form.tag }}
<span class="help-inline">{{ form.tag.errors }}</span>
</div>
</div>
{# preview #}
{% include 'c_admin/forms/multilang.html' with field='preview' form=form languages=languages %}
{# author #}
<div class="control-group {% if form.author.errors %}error{% endif %}">
<label class="control-label">{{ form.author.label }}:</label>
<div class="controls">
{{ form.author }}
<span class="help-inline">{{ form.author.errors }}</span>
</div>
</div>
{# description #}
{% include 'c_admin/forms/multilang.html' with field='description' form=form languages=languages %}
{# keywords #}
{% include 'c_admin/forms/multilang.html' with field='keywords' form=form languages=languages %}
{# title #}
{% include 'c_admin/forms/multilang.html' with field='title' form=form languages=languages %}
{# descriptions #}
{% include 'c_admin/forms/multilang.html' with field='descriptions' form=form languages=languages %}
</div>
</div>
<div class="box span8" id="file">
<div class="box-header well">
<h2><i class="icon-pencil"></i> Файлы</h2>
</div>
<div class="box-content">
{# button that shows modal window with file form #}
<a href="#myModal" id="file_add" role="button" class="btn btn-info" data-toggle="modal">Добавить файл</a>
{# this div shows list of files and refreshes when new file added #}
<div id="file_list">
<table class="table table-hover">
<thead>
<tr>
<td>id</td>
<td>Файл</td>
<td>Имя</td>
<td>Назначение</td>
<td></td>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr>
<td>{{ file.id }}</td>
<td><img src="{{ file.file_path.url }}"></td>
<td>{{ file.file_name }}</td>
<td>{{ file.purpose }}</td>
<td>
<button class="btn btn-danger delete_file" value="{{ file.id }}">
<i class="icon-trash icon-white"></i> Удалить
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="controls">
<input class="btn btn-large btn-primary" type="submit" value="Добавить">
<input class="btn btn-large" type="reset" value="Отмена">
</div>
</fieldset>
</form>
{# modal window #}
<div class="modal hide fade" id="myModal" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="close">&times;</button>
<h3>Добавить файл</h3>
</div>
<div id="form_body">
<div class="modal-body">
<form method="post" class="form-horizontal" enctype="multipart/form-data" name="file_form" id="file_form" > {% csrf_token %}
{# hidden inputs uses for comparing with Article form key#}
{{ file_form.key }}
{{ file_form.model }}
<input type="hidden" id="obj_id" value="{{ obj_id }}">
{# file_path #}
<div class="control-group{% if file_form.file_path.errors %}error{% endif %}">
<label class="control-label"><b>{{ file_form.file_path.label }}:</b></label>
<div class="controls">{{ file_form.file_path }}
<span class="help-inline">{{ file_form.file_path.errors }}</span>
</div>
</div>
{# file purpose #}
<div class="control-group{% if file_form.purpose.errors %}error{% endif %}">
<label class="control-label"><b>{{ file_form.purpose.label }}:</b></label>
<div class="controls">{{ file_form.purpose }}
<span class="help-inline">{{ file_form.purpose.errors }}</span>
</div>
</div>
{# file_name #}
{% with field='file_name' form=file_form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# file_description #}
{% with field='description' form=file_form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
</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">
</form>
</div>
</div>
</div>
</div>
{% endblock %}

@ -1,69 +0,0 @@
{% extends 'base.html' %}
{% block body %}
{% comment %}
Displays lists of all articles in the table
and creating buttons which can change each article
{% endcomment %}
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-arrow-down"></i>Список статей</h2>
</div>
<div class="box-content">
<form class='form-search'>
{{ search_form.search_name }}
<button type="submit" class="btn">Найти</button>
</form>
<table class="table table-hover">
<thead>
<tr>
<th>Заголовок</th>
<th>Автор</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for item in objects %}
<tr>
<td>{{ item.main_title }}</td>
<td>{% ifnotequal item.user None %}{{ item.user }} {% endifnotequal %}</td>
<td class="center sorting_1">
<a class="btn-small btn-info" href="/admin/article/change/{{ item.url|lower }}">
Изменить
</a>
</td>
<td class="center sorting_1">
<a class="btn-small btn-inverse" href="/admin/article/copy/{{ item.url|lower }}">
Копировать
</a>
</td>
<td>
<a class="btn-small btn-danger delete" href="/admin/article/delete/{{ item.url }}/">
Удалить
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<a class="btn btn-success" href="/admin/article/add"><i class="icon-plus-sign icon-white"></i> Добавить статью</a>
</div>
<div class="pagination pagination-centered">
<ul>
{% if objects.has_previous %}
<li> <a href="?page={{ objects.previous_page_number }}"></a></li>
{% endif %}
{% if objects.has_next %}
<li><a href="?page={{ objects.next_page_number }}"></a></li>
{% endif %}
</ul>
</div>
</div>
{% endblock %}

@ -8,4 +8,4 @@
<a class="btn btn-large btn-primary" href = "/admin/article/blog/all">Нет</a>
</div>
</form>
{% endblock %}
{% endblock %}

@ -1,34 +1,35 @@
{% extends 'base.html' %}
{% load static i18n %}
{% block scripts %}
<script src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script>
{# selects #}
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/>
<script src="{% static 'js/select/select2.js' %}"></script>
{# ajax #}
<script src="{% static 'custom_js/file_post_ajax.js' %}"></script>
<script src="{% static 'custom_js/select_tag.js' %}"></script>
<link href="{% static 'js/datetimepicker/css/datetimepicker.css' %}" rel="stylesheet"/>
<script src="{% static 'js/datetimepicker/js/bootstrap-datetimepicker.js' %}"></script>
<script>
$(document).ready(function(){
$('#id_publish_date').datetimepicker({
todayHighlight: true,
format : 'yyyy-mm-dd',
minView:2
});
});
</script>
<link rel="stylesheet" href="{% static 'jQuery-filer/css/jquery.filer.css' %}">
<link rel="stylesheet" href="{% static 'jQuery-filer/css/jquery.filer-dragdropbox-theme.css' %}">
<script src="{% static 'jQuery-filer/js/jquery.filer.js' %}"></script>
<script src="{% static 'jQuery-filer/js/init.js' %}"></script>
{% endblock %}
{% load static %}
{% load i18n %}
{# Displays article form #}
{% block scripts %}
<script src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script>
{# selects #}
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/>
<script src="{% static 'js/select/select2.js' %}"></script>
<script src="{% static 'custom_js/make_select.js' %}"></script>
{# ajax #}
<script src="{% static 'custom_js/file_post_ajax.js' %}"></script>
<script src="{% static 'custom_js/select_tag.js' %}"></script>
<link href="{% static 'js/datetimepicker/css/datetimepicker.css' %}" rel="stylesheet"/>
<script src="{% static 'js/datetimepicker/js/bootstrap-datetimepicker.js' %}"></script>
<script>
$(document).ready(function(){
$('#id_publish_date').datetimepicker({
todayHighlight: true,
format : 'yyyy-mm-dd',
minView:2
});
});
</script>
{% endblock %}
{% block body %}
{{ form.errors }}
@ -132,9 +133,38 @@
</div>
</div>
<div class="box span8" id="file">
<div class="box-header well">
<h2><i class="icon-pencil"></i> {% trans "Файлы" %}</h2>
</div>
<div class="box-content">
{% if article %}
{# button that shows modal window with file form #}
<a href="#myModal" id="file_add" role="button" class="btn btn-info" data-toggle="modal">{% trans "Добавить файл" %}</a>
{% else %}
<p>{% trans "Файлы можно добавлять только после введения основных данных" %}</p>
{% endif %}
{# this div shows list of files and refreshes when new file added #}
<div id="file_list">
<table class="table table-hover">
{% include 'c_admin/includes/filegallery.html' with object=article model='article.Article' %}
<thead>
<tr>
<td>{% trans "id" %}</td>
<td>{% trans "Файл" %}</td>
<td>{% trans "Имя" %}</td>
<td>{% trans "Назначение" %}</td>
<td></td>
</tr>
</thead>
<tbody>
{% include 'file_list.html' with files=files %}
</tbody>
</table>
</div>
</div>
</div>
{% if form.draft %}
<div class="box span8">
<div class="control-group {% if form.draft.errors %}error{% endif %}">
@ -154,6 +184,7 @@
</fieldset>
</form>
{% include 'c_admin/includes/file_form.html' with file_form=file_form object=article %}
{% endblock %}

@ -35,7 +35,7 @@
{% endblock %}
</div>
{# pagination #}
{% include 'c_admin/includes/admin_pagination.html' with page_obj=object_list %}
{% include 'c_admin/includes/admin_pagination.html' %}
</div>
<a href="{% url 'expobanner-baneers_control' %}">{% trans "Назад к управлению баннерами" %}</a>
{% endblock %}

@ -52,6 +52,7 @@
<li><a href="{% url 'settings_default_description' %}">{% trans 'Описание по умолчанию' %}</a></li>
<li><a href="/admin/meta/all/">Мета</a></li>
<li><a href="/admin/meta/seo/all/">Список seo-текстов</a></li>
<li><a href="/admin/rosetta/">Перевод</a></li>
<li><a href="{% url 'redirects-list' %}">Редиректы</a></li>

@ -1,31 +0,0 @@
{% extends 'base.html' %}
{% load static %}
{% block body %}
<form method="post" class="form-horizontal" enctype="multipart/form-data" name="form1" id="form1"> {% csrf_token %}
<fieldset>
<legend><i class="icon-edit"></i> Настройки</legend>
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-pencil"></i> Основные настройки</h2>
</div>
<div class="box-content">
{# key #}
{% with field='hall_capacity_tmpl' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
</div>
</div>
<div class="controls">
<input class="btn btn-large btn-primary" type="submit" value="Добавить">
<input class="btn btn-large" type="reset" value="Отмена">
</div>
</fieldset>
</form>
{% endblock %}

@ -42,18 +42,6 @@
{% with field='description' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# keywords #}
{% with field='keywords' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# title #}
{% with field='title' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# descriptions #}
{% with field='descriptions' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
</div>
</div>

@ -1,150 +0,0 @@
{% extends 'base_catalog.html' %}
{% load static %}
{% load i18n %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
<a href="/">{% trans 'Главная страница' %}</a>
<strong>{{ object.name }}</strong>
</div>
{% endblock %}
{% block page_title %}
{% endblock %}
{% if object.get_events %}
{% block head_scripts %}
{% include "client/includes/banners/tops_head_js.html" %}
{% endblock head_scripts %}
{% endif %}
{% block content_list %}
<div class="m-article">
<div class="item-wrap place clearfix">
<aside>
<div class="i-pict">
{% include 'client/includes/show_logo.html' with obj=object %}
</div>
</aside>
<div class="i-info">
<header>
<h1 class="i-title">{{ object.name }}</h1>
</header>
<table class="country_table">
<tr>
<td>
<ul>
{% if object.population %}
<li><strong>{% trans 'Население' %}:</strong><span>{{ object.population }} {% trans 'человек' %}</span></li>
{% endif %}
{% if object.code_IATA %}
<li>Код IATA:<span>{{ object.code_IATA.code }}</span></li>
{% endif %}
{% if object.phone_code %}
<li>{% trans 'Телефонный код' %}:<span>+{{ object.phone_code }}</span></li>
{% endif %}
{% if object.transport %}
<li><i>{% trans 'Транспорт' %}:</i><span>{{ object.transport }}</span></li>
{% endif %}
</ul>
</td>
</tr>
</table>
<div class="i-address map-opened country_map">
<div class="i-map">
<!-- позиция для карты задается в атрибуте data-coords -->
<div class="map-canvas" id="map-canvas" data-coords="{{ object.latitude|stringformat:'f' }},{{ object.longitude|stringformat:'f' }}" ></div>
<div class="close-map"><a class="toggle-map" href="#">{% trans 'Скрыть карту' %}</a></div>
</div>
<header>
<div class="show-map show-map_1"><a class="toggle-map" href="#">{% trans 'Раскрыть карту' %}</a></div>
</header>
</div>
</div>
</div>
<table class="map_info_block">
{% if object.famous_places %}
<tr>
<th>{% trans 'Должны посетить' %}:</th>
<td class="width_1">
{{ object.famous_places }}
</td>
</tr>
{% endif %}
{% if object.shoping %}
<tr>
<th>{% trans 'Шоппинг' %}:</th>
<td class="width_1">
{{ object.shoping }}
</td>
</tr>
{% endif %}
</table>
{% if object.description %}
<hr />
<div class="i-services country_content">
<h2 class="sect-title">{% trans "Описание" %}</h2>
<div class="i-descr">
{{ object.description }}
</div>
</div>
{% endif %}
{% if object.get_photos %}
<div class="i-photo-slides i-photo-slides_1">
<h2 class="sect-title">{% trans "Фотогалерея" %}</h2>
<div id="ps-photo-gallery" class="ps-photo-gallery swiper-container">
<ul class="swiper-wrapper">
<li class="swiper-slide"><img src="img/_del-temp/place-photo-1.jpg" alt="" /></li>
<li class="swiper-slide"><img src="img/_del-temp/event-photo-1.jpg" alt="" /></li>
</ul>
<div class="re-controls">
<a class="prev" href="#">&lt;</a>
<a class="next" href="#">&gt;</a>
</div>
</div>
</div>
{% endif %}
</div>
{% if object.get_events %}
<br>
<div class="i-events-list">
<div class="sect-title blog_link">
<a href="#" title="">{% trans 'События в' %} {{ object.name }}</a><a class="button more" href="{{ object.events_catalog }}">{% trans 'Все события' %}</a>
</div>
{% include 'includes/exposition/exposition_list.html' with object_list=object.get_events %}
</div>
{% endif %}
{% if object.get_places %}
<br>
<div class="i-events-list">
<div class="sect-title blog_link">
<a href="#" title="">{% trans 'Места в' %} {{ object.name }}</a><a class="button more" href="{{ object.places_catalog }}">{% trans 'Все места' %}</a>
</div>
{% include 'includes/place/place_list.html' with object_list=object.get_places %}
</div>
{% endif %}
{% if object.get_organisers %}
<br>
<div class="i-events-list">
<div class="sect-title blog_link">
<a href="#" title="">{% trans 'Организаторы в' %} {{ object.name }}</a><a class="button more" href="#">{% trans 'Все организаторы' %} </a>
</div>
{% include 'includes/organiser/organiser_list.html' with object_list=object.get_organisers %}
</div>
{% endif %}
{% endblock %}

@ -56,7 +56,7 @@
{% block page_title %}
<div class="page-title">
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Выставки' %}: <strong>{{ filter_object.name }}</strong>{% endif %}</h1>
<h1>{% if meta %}{{ meta.h1 }}{% elif seo_text %}{{ seo_text.title }}{% else %}{% trans 'Выставки' %}: <strong>{{ filter_object.name }}</strong>{% endif %}</h1>
</div>
{% include 'includes/exposition/catalog_filter_period.html' %}

@ -32,6 +32,6 @@
{% else %}
<title>{% block title_head %}{% trans 'Expomap — выставки, конференции, семинары' %}{% endblock %}</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="description" content="">
{% endif %}

@ -1,61 +1,56 @@
{% load static %}
{% load i18n %}
{% load static i18n %}
{% with objects=object_list %}
{% include 'client/includes/banners/tops.html' %}
<ul class="cat-list cl-places">
{% for object in object_list %}
<li class="cl-item">
<div class="cl-item-wrap clearfix">
<a target="_blank" href="{{ object.get_permanent_url }}">
<div class="cli-pict">
{% with obj=object %}
{% include 'client/includes/show_logo.html' %}
{% endwith %}
</div>
</a>
<div class="cli-info">
<div class="cli-top clearfix">
{% include 'client/includes/banners/tops.html' %}
<ul class="cat-list cl-places">
{% for object in object_list %}
<li class="cl-item">
<div class="cl-item-wrap clearfix">
<a target="_blank" href="{{ object.get_permanent_url }}">
<div class="cli-pict">
{% include 'client/includes/show_logo.html' with obj=object %}
</div>
</a>
<div class="cli-info">
<div class="cli-top clearfix">
<header>
<div class="cli-title"><a target="_blank" href="{{ object.get_permanent_url }}">{{ object.name|safe }}</a></div>
<!--<div class="cli-rate">{{ object.rating }}</div>-->
</header>
<header>
<div class="cli-title"><a target="_blank" href="{{ object.get_permanent_url }}">{{ object.name|safe }}</a></div>
{# <div class="cli-rate">{{ object.rating }}</div>#}
</header>
<div class="cli-descr">{{ object.get_type }}</div>
</div>
<div class="cli-descr">{{ object.get_type }}</div>
</div>
<div class="cli-bot clearfix">
{% if object.total_area %}
<div class="cli-dim">{{ object.total_area }} м2</div>
{% endif %}
<div class="cli-place"><a href="/places/country/{{ object.country.url }}/">{{ object.country }}</a>, <a href="/places/city/{{ object.city.url }}/">{{ object.city }}</a>
</div>
</div>
<div class="cli-bot clearfix">
{% if object.total_area %}
<div class="cli-dim">{{ object.total_area }} м2</div>
{% endif %}
<div class="cli-place"><a href="/places/country/{{ object.country.url }}/">{{ object.country }}</a>, <a href="/places/city/{{ object.city.url }}/">{{ object.city }}</a>
</div>
</div>
</div>
<div class="cli-buttons clearfix">
<div class="cli-m-buttons">
<a class="button icon-info" href="{{ object.get_permanent_url }}">{% trans 'описание' %}</a>
{% if object.get_events_number %}
<a class="button green icon-list" href="#">{% trans 'события' %} ({{ object.get_events_number }})</a>
{% endif %}
{% if object.photogallery %}
<a class="button blue icon-photo" href="{{ object.get_permanent_url }}photo/">{% trans 'фото' %}</a>
{% endif %}
</div>
<div class="cli-s-buttons">
<a class="button blue2 lc" target="_blank" href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ object.city.id }}">{% trans 'Найти отели поблизости' %}</a>
</div>
<div class="cli-buttons clearfix">
<div class="cli-m-buttons">
<a class="button icon-info" href="{{ object.get_permanent_url }}">{% trans 'описание' %}</a>
{% if object.get_events_number %}
<a class="button green icon-list" href="{% url 'place_exposition_list' object.url %}">{% trans 'события' %} ({{ object.get_events_number }})</a>
{% endif %}
{% if object.photogallery %}
<a class="button blue icon-photo" href="{{ object.get_permanent_url }}photo/">{% trans 'фото' %}</a>
{% endif %}
</div>
<div class="cli-s-buttons">
<a class="button blue2 lc" target="_blank" href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ object.city.id }}">{% trans 'Найти отели поблизости' %}</a>
</div>
</li>
{% if forloop.counter == 5 or objects|length < 5 %}
{% include 'client/includes/banners/catalog_inner_2.html' %}
{% endif %}
</div>
</li>
{% if forloop.counter == 5 or object_list|length < 5 %}
{% include 'client/includes/banners/catalog_inner_2.html' %}
{% endif %}
{% if forloop.counter == 10 %}
{% include 'client/includes/banners/catalog_inner.html' %}
{%endif %}
{% endfor %}
</ul>
{% endwith %}
{% if forloop.counter == 10 %}
{% include 'client/includes/banners/catalog_inner.html' %}
{%endif %}
{% endfor %}
</ul>

@ -114,7 +114,7 @@
</div>
{% endif %}
{# TODO: request optization #}
{# TODO: request optimization #}
{% if object.halls.count %}
<div class="eni-areas clearfix">
<div class="enis-col">

Loading…
Cancel
Save