remotes/origin/1203
kotzilla 11 years ago
parent 4622cc7745
commit 2c28e0a4e9
  1. 6
      accounts/urls.py
  2. 1
      accounts/views.py
  3. 10
      article/admin_urls.py
  4. 4
      core/views.py
  5. 23
      country/models.py
  6. 20
      exposition/manager.py
  7. 88
      exposition/models.py
  8. 16
      functions/admin_forms.py
  9. 62
      functions/admin_views.py
  10. 4
      functions/custom_views.py
  11. 153
      functions/search_forms.py
  12. 3
      photologue/admin.py
  13. 11
      photologue/forms.py
  14. 26
      photologue/management/commands/photologue_exposize.py
  15. 23
      photologue/models.py
  16. 12
      photoreport/models.py
  17. 71
      place_exposition/admin.py
  18. 7
      place_exposition/admin_urls.py
  19. 5
      place_exposition/forms.py
  20. 61
      place_exposition/management/commands/convert_photo.py
  21. 35
      place_exposition/models.py
  22. 26
      proj/settings.py
  23. 9
      proj/urls.py
  24. 10
      settings/templatetags/template_filters.py
  25. 1
      static/client
  26. 0
      static/client.old/css/idangerous.swiper.css
  27. 0
      static/client.old/css/idangerous.swiper.scrollbar.css
  28. 0
      static/client.old/css/jquery-ui-1.10.3.custom.css
  29. 0
      static/client.old/css/jquery.fancybox.css
  30. 0
      static/client.old/css/jquery.mCustomScrollbar.css
  31. 0
      static/client.old/css/main.css
  32. 0
      static/client.old/css/normalize.css
  33. 0
      static/client.old/css/normalize.min.css
  34. 0
      static/client.old/css/pages/exposition_by.css
  35. 0
      static/client.old/css/phototag.css
  36. 0
      static/client.old/css/regions.css
  37. 0
      static/client.old/css/select2.css
  38. 0
      static/client.old/fonts/pfdindisplaypro-bold-webfont.eot
  39. 0
      static/client.old/fonts/pfdindisplaypro-bold-webfont.svg
  40. 0
      static/client.old/fonts/pfdindisplaypro-bold-webfont.ttf
  41. 0
      static/client.old/fonts/pfdindisplaypro-bold-webfont.woff
  42. 0
      static/client.old/fonts/pfdindisplaypro-italic-webfont.eot
  43. 0
      static/client.old/fonts/pfdindisplaypro-italic-webfont.svg
  44. 0
      static/client.old/fonts/pfdindisplaypro-italic-webfont.ttf
  45. 0
      static/client.old/fonts/pfdindisplaypro-italic-webfont.woff
  46. 0
      static/client.old/fonts/pfdindisplaypro-light-webfont.eot
  47. 0
      static/client.old/fonts/pfdindisplaypro-light-webfont.svg
  48. 0
      static/client.old/fonts/pfdindisplaypro-light-webfont.ttf
  49. 0
      static/client.old/fonts/pfdindisplaypro-light-webfont.woff
  50. 0
      static/client.old/fonts/pfdindisplaypro-med-webfont.eot
  51. 0
      static/client.old/fonts/pfdindisplaypro-med-webfont.svg
  52. 0
      static/client.old/fonts/pfdindisplaypro-med-webfont.ttf
  53. 0
      static/client.old/fonts/pfdindisplaypro-med-webfont.woff
  54. 0
      static/client.old/fonts/pfdindisplaypro-reg-webfont.eot
  55. 0
      static/client.old/fonts/pfdindisplaypro-reg-webfont.svg
  56. 0
      static/client.old/fonts/pfdindisplaypro-reg-webfont.ttf
  57. 0
      static/client.old/fonts/pfdindisplaypro-reg-webfont.woff
  58. 0
      static/client.old/fonts/pfdindisplaypro-thin-webfont.eot
  59. 0
      static/client.old/fonts/pfdindisplaypro-thin-webfont.svg
  60. 0
      static/client.old/fonts/pfdindisplaypro-thin-webfont.ttf
  61. 0
      static/client.old/fonts/pfdindisplaypro-thin-webfont.woff
  62. 0
      static/client.old/fonts/pts55f-webfont.eot
  63. 0
      static/client.old/fonts/pts55f-webfont.ttf
  64. 0
      static/client.old/fonts/pts55f-webfont.woff
  65. 0
      static/client.old/fonts/pts75f-webfont.eot
  66. 0
      static/client.old/fonts/pts75f-webfont.ttf
  67. 0
      static/client.old/fonts/pts75f-webfont.woff
  68. 0
      static/client.old/img/1.png
  69. 0
      static/client.old/img/2.png
  70. 0
      static/client.old/img/Thumbs.db
  71. 0
      static/client.old/img/_del-temp/Thumbs.db
  72. 0
      static/client.old/img/_del-temp/banner-2.gif
  73. 0
      static/client.old/img/_del-temp/banner.gif
  74. 0
      static/client.old/img/_del-temp/bnrs-2.jpg
  75. 0
      static/client.old/img/_del-temp/bnrs.jpg
  76. 0
      static/client.old/img/_del-temp/cl-logo-1.png
  77. 0
      static/client.old/img/_del-temp/cl-logo-2.png
  78. 0
      static/client.old/img/_del-temp/cl-logo-3.png
  79. 0
      static/client.old/img/_del-temp/counter-1.gif
  80. 0
      static/client.old/img/_del-temp/counter-2.gif
  81. 0
      static/client.old/img/_del-temp/counter-3.gif
  82. 0
      static/client.old/img/_del-temp/editor.png
  83. 0
      static/client.old/img/_del-temp/event-photo-1.jpg
  84. 0
      static/client.old/img/_del-temp/expo-bn-1.jpg
  85. 0
      static/client.old/img/_del-temp/expo-bn-2-s.jpg
  86. 0
      static/client.old/img/_del-temp/glr-1.jpg
  87. 0
      static/client.old/img/_del-temp/hotel-1.jpg
  88. 0
      static/client.old/img/_del-temp/mail-banner.jpg
  89. 0
      static/client.old/img/_del-temp/mp-phg-1.jpg
  90. 0
      static/client.old/img/_del-temp/mp-phg-1.png
  91. 0
      static/client.old/img/_del-temp/news-1.jpg
  92. 0
      static/client.old/img/_del-temp/news-s-1.jpg
  93. 0
      static/client.old/img/_del-temp/part-logo-1.png
  94. 0
      static/client.old/img/_del-temp/part-logo-2.png
  95. 0
      static/client.old/img/_del-temp/part-logo-3.png
  96. 0
      static/client.old/img/_del-temp/pg-1.jpg
  97. 0
      static/client.old/img/_del-temp/pg-2.jpg
  98. 0
      static/client.old/img/_del-temp/pg-3.jpg
  99. 0
      static/client.old/img/_del-temp/pg-4.jpg
  100. 0
      static/client.old/img/_del-temp/phr-1.jpg
  101. Some files were not shown because too many files have changed in this diff Show More

@ -4,6 +4,12 @@ from django.contrib.auth.decorators import login_required
from views import SettingsView, ProfileView, CalendarView, UserView, UserExpositionsView, UserConferenceView, UserSeminarView from views import SettingsView, ProfileView, CalendarView, UserView, UserExpositionsView, UserConferenceView, UserSeminarView
from views import NameView, HomeView, AvatarView, WorkView, AboutCompanyView, PhoneView, EmailView, WebPageView,\ from views import NameView, HomeView, AvatarView, WorkView, AboutCompanyView, PhoneView, EmailView, WebPageView,\
SocialView, AboutView, ProfileCompanyView SocialView, AboutView, ProfileCompanyView
#
from django.http import HttpResponse
def test(request):
return HttpResponse('123')
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^profile/$', login_required(ProfileView.as_view())), url(r'^profile/$', login_required(ProfileView.as_view())),

@ -209,6 +209,7 @@ class ProfileInvalidView(FormView):
""" """
def form_invalid(self, form): def form_invalid(self, form):
response = {'success': False} response = {'success': False}
response.update({'errors': form.errors})
return HttpResponse(json.dumps(response), content_type='application/json') return HttpResponse(json.dumps(response), content_type='application/json')

@ -4,11 +4,11 @@ from admin import BlogList, BlogView, NewsList, NewsView
urlpatterns = patterns('article.admin', urlpatterns = patterns('article.admin',
url(r'^add/$', 'article_add'), #url(r'^add/$', 'article_add'),
url(r'^delete/(?P<url>.*)/$', 'article_delete'), #url(r'^delete/(?P<url>.*)/$', 'article_delete'),
url(r'^change/(.*)/$', 'article_change'), #url(r'^change/(.*)/$', 'article_change'),
url(r'^copy/(.*)/$', 'article_copy'), #url(r'^copy/(.*)/$', 'article_copy'),
url(r'^all/$', 'article_all'), #url(r'^all/$', 'article_all'),
url(r'^blog/all/$', BlogList.as_view()), url(r'^blog/all/$', BlogList.as_view()),
url(r'^blog/$', BlogView.as_view()), url(r'^blog/$', BlogView.as_view()),
url(r'^news/all/$', NewsList.as_view()), url(r'^news/all/$', NewsList.as_view()),

@ -145,7 +145,7 @@ class PlaceListView(ListView):
return context return context
class PlacePhotoView(PlaceListView): class PlacePhotoView(PlaceListView):
paginate_by = 10 paginate_by = 5
template_name = 'place/place_photo.html' template_name = 'place/place_photo.html'
obj = None obj = None
@ -189,7 +189,7 @@ class PlacePhotoView(PlaceListView):
self.params = params self.params = params
self.obj = query[0] self.obj = query[0]
return query[0].get_photos() return query[0].photogallery.photos.all()
self.params = params self.params = params
return list(pl_ex) + list(pl_conf) return list(pl_ex) + list(pl_conf)

@ -18,6 +18,7 @@ from functions.custom_fields import EnumField
from functions.db import db_table_exists from functions.db import db_table_exists
from functions.signal_handlers import post_save_handler, pre_save_handler from functions.signal_handlers import post_save_handler, pre_save_handler
from django.utils.translation import get_language as lang from django.utils.translation import get_language as lang
from django.utils import translation
# check if table exist and create flags if true # check if table exist and create flags if true
flags = [str(item.url) for item in Service.objects.all()] if db_table_exists('service_service') else [] flags = [str(item.url) for item in Service.objects.all()] if db_table_exists('service_service') else []
@ -36,14 +37,36 @@ class CountryManager(TranslationManager):
except: except:
return None return None
class AreaManager(TranslationManager):
def all_sorted(self):
"""
return list, not queryset
"""
model = self.model
result = list(model.objects.filter())
result.sort(key=lambda x: len(x.expos()), reverse=True)
return result
class Area(TranslatableModel): class Area(TranslatableModel):
translations = TranslatedFields( translations = TranslatedFields(
name = models.CharField(max_length=255), name = models.CharField(max_length=255),
) )
objects = AreaManager()
def __unicode__(self): def __unicode__(self):
return self.lazy_translation_getter('name', unicode(self.pk)) return self.lazy_translation_getter('name', unicode(self.pk))
def countries(self):
return Country.objects.select_related('exposition_country')\
.filter(exposition_country__country__isnull=False, translations__language_code='ru', area=self).distinct()
def expos(self):
countries = self.countries()
return Exposition.objects.filter(country__in=countries)
class Country(TranslatableModel): class Country(TranslatableModel):
""" """

@ -0,0 +1,20 @@
from hvad.models import TranslationManager
class ClientManager(TranslationManager):
def get_query_set(self):
return super(ClientManager, self).get_query_set().filter(is_published=True)
"""
from exposition.models import Exposition
from django.db import connection
from django.utils import translation
translation.activate('en')
len(connection.queries)
e = list(Exposition.enable.list())
"""

@ -9,6 +9,7 @@ from bitfield import BitField
from service.models import Service from service.models import Service
from functions.db import db_table_exists from functions.db import db_table_exists
from organiser.models import Organiser from organiser.models import Organiser
from manager import ClientManager
# #
from functions.custom_fields import EnumField from functions.custom_fields import EnumField
from functions.signal_handlers import post_save_handler, pre_save_handler from functions.signal_handlers import post_save_handler, pre_save_handler
@ -39,17 +40,14 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
Uses hvad.TranslatableModel which is child of django.db.models class Uses hvad.TranslatableModel which is child of django.db.models class
""" """
#set manager of this model # main
objects = ExpoManager()
catalog = '/expo/' catalog = '/expo/'
url = models.SlugField(unique=True) url = models.SlugField(unique=True)
#logo = fo
data_begin = models.DateField(verbose_name='Дата начала') data_begin = models.DateField(verbose_name='Дата начала')
data_end = models.DateField(verbose_name='Дата окончания') data_end = models.DateField(verbose_name='Дата окончания')
services = BitField(flags=flags) services = BitField(flags=flags)
quality_label = BitField(flags=['ufi', 'rsva', 'exporating'])
audience = BitField(flags=[k for k, v in BIT_AUDIENCE])
# relations # relations
country = models.ForeignKey('country.Country', verbose_name='Страна', on_delete=models.PROTECT, country = models.ForeignKey('country.Country', verbose_name='Страна', on_delete=models.PROTECT,
related_name='exposition_country') related_name='exposition_country')
@ -67,25 +65,58 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
blank=True, null=True, related_name='exposition_companies') blank=True, null=True, related_name='exposition_companies')
users = models.ManyToManyField('accounts.User', verbose_name='Посетители выставки', users = models.ManyToManyField('accounts.User', verbose_name='Посетители выставки',
blank=True, null=True, related_name='exposition_users') blank=True, null=True, related_name='exposition_users')
#photogallery = models.ForeignKey('photologue.Gallery', blank=True, null=True)
quality_label = BitField(flags=['ufi', 'rsva', 'exporating'])
visitors = models.PositiveIntegerField(verbose_name='Посетители', blank=True, null=True)
members = models.PositiveIntegerField(verbose_name='Участники', blank=True, null=True)
discount = models.PositiveIntegerField(verbose_name='Скидка', blank=True, null=True)
expohit = models.BooleanField(verbose_name='Expohit', default=0)
# administrator can cancel exposition
canceled_by_administrator = models.BooleanField(default=0)
#can publish not immediately
is_published = models.BooleanField(default=0)
canceled = models.BooleanField(default=0)
moved = models.BooleanField(default=0)
# field saves information about creating and changing model
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
main_page = models.PositiveIntegerField(default=0, db_index=True)
views = models.PositiveIntegerField(default=0)
translations = TranslatedFields(
name = models.CharField(verbose_name='Название', max_length=255),
main_title = models.TextField(verbose_name='Краткое описание', blank=True),
description = models.TextField(verbose_name='Описание', blank=True),
products = models.TextField(verbose_name='Экспонируемые продукты', blank=True),
discount_description = models.TextField(verbose_name='Описание скидки', blank=True),
time = models.TextField(verbose_name='Время работы', blank=True),
#-----meta data
title = models.CharField(max_length=250),
descriptions = models.CharField(max_length=250),
keywords = models.CharField(max_length=250),
)
files = generic.GenericRelation('file.FileModel', content_type_field='content_type', object_id_field='object_id')
#about
periodic = models.FloatField(verbose_name='Переодичность', blank=True, null=True) periodic = models.FloatField(verbose_name='Переодичность', blank=True, null=True)
#audience = EnumField(values=AUDIENCE, blank=True) audience = BitField(flags=[k for k, v in BIT_AUDIENCE])
web_page = models.CharField(verbose_name='Вебсайт', max_length=255, blank=True) web_page = models.CharField(verbose_name='Вебсайт', max_length=255, blank=True)
foundation_year = models.PositiveIntegerField(verbose_name='Год основания', blank=True, null=True)
# conditions of Participation
registration_link = models.URLField(verbose_name='Ссылка на регистрацию', max_length=255, blank=True) registration_link = models.URLField(verbose_name='Ссылка на регистрацию', max_length=255, blank=True)
min_area = models.PositiveIntegerField(verbose_name='Минимальная площадь', blank=True, null=True) min_area = models.PositiveIntegerField(verbose_name='Минимальная площадь', blank=True, null=True)
#
currency = EnumField(values=CURRENCY, default='USD') currency = EnumField(values=CURRENCY, default='USD')
application_deadline = models.DateField(verbose_name='Срок подачи заявки', null=True) application_deadline = models.DateField(verbose_name='Срок подачи заявки', null=True)
min_stand_size = models.PositiveIntegerField(verbose_name='Минимальный размер стэнда', blank=True, null=True) min_stand_size = models.PositiveIntegerField(verbose_name='Минимальный размер стэнда', blank=True, null=True)
price_day = models.PositiveIntegerField(verbose_name='Стоимость билета 1 день', blank=True, null=True) price_day = models.PositiveIntegerField(verbose_name='Стоимость билета 1 день', blank=True, null=True)
price_all = models.PositiveIntegerField(verbose_name='Стоимость билета все дни', blank=True, null=True) price_all = models.PositiveIntegerField(verbose_name='Стоимость билета все дни', blank=True, null=True)
price_day_bar = models.PositiveIntegerField(verbose_name='Стоимость на стойке 1 день', blank=True, null=True) price_day_bar = models.PositiveIntegerField(verbose_name='Стоимость на стойке 1 день', blank=True, null=True)
price_all_bar = models.PositiveIntegerField(verbose_name='Стоимость на стойке все дни', blank=True, null=True) price_all_bar = models.PositiveIntegerField(verbose_name='Стоимость на стойке все дни', blank=True, null=True)
price_catalog = models.PositiveIntegerField(verbose_name='Стоимость каталога', blank=True, null=True) price_catalog = models.PositiveIntegerField(verbose_name='Стоимость каталога', blank=True, null=True)
tax = models.BooleanField(verbose_name='Налог', default=1) tax = models.BooleanField(verbose_name='Налог', default=1)
min_closed_area = models.PositiveIntegerField(verbose_name='Минимальная цена закрытой НЕ оборудованной площади', min_closed_area = models.PositiveIntegerField(verbose_name='Минимальная цена закрытой НЕ оборудованной площади',
blank=True, null=True) blank=True, null=True)
@ -101,41 +132,12 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
blank=True, null=True) blank=True, null=True)
registration_payment = models.PositiveIntegerField(verbose_name='Регистрационный взнос', blank=True, null=True) registration_payment = models.PositiveIntegerField(verbose_name='Регистрационный взнос', blank=True, null=True)
discount = models.PositiveIntegerField(verbose_name='Скидка', blank=True, null=True)
expohit = models.BooleanField(verbose_name='Expohit', default=0)
# administrator can cancel exposition
canceled_by_administrator = models.BooleanField(default=0)
#can publish not immediately
is_published = models.BooleanField(default=0)
canceled = models.BooleanField(default=0)
moved = models.BooleanField(default=0)
files = generic.GenericRelation('file.FileModel', content_type_field='content_type', object_id_field='object_id')
# statistic # statistic
foundation_year = models.PositiveIntegerField(verbose_name='Год основания', blank=True, null=True)
visitors = models.PositiveIntegerField(verbose_name='Посетители', blank=True, null=True)
members = models.PositiveIntegerField(verbose_name='Участники', blank=True, null=True)
translations = TranslatedFields(
name = models.CharField(verbose_name='Название', max_length=255),
main_title = models.TextField(verbose_name='Краткое описание', blank=True),
description = models.TextField(verbose_name='Описание', blank=True),
products = models.TextField(verbose_name='Экспонируемые продукты', blank=True),
discount_description = models.TextField(verbose_name='Описание скидки', blank=True),
time = models.TextField(verbose_name='Время работы', blank=True),
#-----meta data
title = models.CharField(max_length=250),
descriptions = models.CharField(max_length=250),
keywords = models.CharField(max_length=250),
)
# field saves information about creating and changing model
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
main_page = models.PositiveIntegerField(default=0, db_index=True)
views = models.PositiveIntegerField(default=0) enable = ClientManager()
#set manager of this model
objects = ExpoManager()
def __unicode__(self): def __unicode__(self):

@ -0,0 +1,16 @@
from django import forms
from django.conf import settings
class AdminForm(forms.Form):
model = None
def __init__(self, *args, **kwargs):
"""
create dynamical translated fields fields
"""
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

@ -0,0 +1,62 @@
from django.views.generic import FormView
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect
from django.conf import settings
class AdminView(FormView):
obj = None
def set_obj(self):
url = self.kwargs.get('url')
if url:
obj = get_object_or_404(self.model, url=url)
self.obj = obj
return obj
slug = self.kwargs.get('slug')
if slug:
obj = get_object_or_404(self.model, slug=slug)
self.obj = obj
return obj
self.obj = None
return None
def get_context_data(self, **kwargs):
context = super(AdminView, self).get_context_data(**kwargs)
self.set_obj()
context['object'] = self.obj
context['languages'] = settings.LANGUAGES
return context
def form_valid(self, form):
self.set_obj()
form.save(obj=self.obj)
return HttpResponseRedirect(self.success_url)
# example get_form
"""
def get_form(self, form_class):
if self.request.POST:
return super(AdminView, self).get_form(form_class)
self.set_obj()
if self.obj:
obj = self.obj
data = {}
data['theme'] = [item.id for item in article.theme.all()]
data['exposition'] = article.exposition
data['conference'] = article.conference
a = ','.join(['%s:%s'%(item.id, item.name) for item in article.tag.all()])
data['tag'] = ','.join(['%s:%s'%(item.id, item.name) for item in article.tag.all()])
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
form = form_class(data)
#form.fields['tag'].widget.attrs['data-init-text'] = [item.name for item in article.tag.all()]
return form_class(data)
else:
return form_class()
"""

@ -23,7 +23,7 @@ from country.models import Country
@login_required @login_required
def filtered_list(request, objects, template, item_per_page=20): def filtered_list(request, objects, template, item_per_page=settings.ADMIN_PAGINATION):
""" """
Return template with objects in it with pagination Return template with objects in it with pagination
item_per_page - how many objects view in the one page item_per_page - how many objects view in the one page
@ -45,7 +45,7 @@ from django.db.models.loading import get_model
from theme.models import Theme from theme.models import Theme
@staff_member_required @staff_member_required
def objects_list(request, Model, template, item_per_page=20): def objects_list(request, Model, template, item_per_page=settings.ADMIN_PAGINATION):
""" """
Return template with all objects of model Model Return template with all objects of model Model
Model - objects Model Model - objects Model

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import pytils
from django import forms from django import forms
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from haystack.query import EmptySearchQuerySet, SearchQuerySet from haystack.query import EmptySearchQuerySet, SearchQuerySet
@ -88,18 +90,23 @@ class ExpositionSearchForm(forms.Form):
q = forms.CharField(label=_(u'Поиск'), required=False) q = forms.CharField(label=_(u'Поиск'), required=False)
w = forms.CharField(label=_(u'Где'), required=False) w = forms.CharField(label=_(u'Где'), required=False)
th = forms.ModelMultipleChoiceField(label=_(u'Тематика'), queryset=Theme.objects.all(), th = forms.MultipleChoiceField(label=_(u'Тематика'), choices=[(item.id, item.name) for item in Theme.objects.all()],
required=False, widget=forms.SelectMultiple()) required=False, widget=forms.CheckboxSelectMultiple())
tg = forms.CharField(label=_(u'Теги'), required=False, widget=forms.SelectMultiple()) tg = forms.CharField(label=_(u'Теги'), required=False, widget=forms.CheckboxSelectMultiple())
area = forms.MultipleChoiceField(label=_(u'Регион'), choices=[(item.id, item.name) for item in Area.objects.language()], area = forms.MultipleChoiceField(label=_(u'Регион'), choices=[(item.id, item.name) for item in Area.objects.all_sorted()],
required=False, widget=forms.CheckboxSelectMultiple()) required=False, widget=forms.CheckboxSelectMultiple())
co = forms.MultipleChoiceField(label=_(u'Страна'), choices=[(item.id, item.name) for item in Country.objects.select_related('exposition_country')\ co = forms.MultipleChoiceField(label=_(u'Страна'), required=False, widget=forms.CheckboxSelectMultiple(),
.filter(exposition_country__country__isnull=False, translations__language_code=translation.get_language())\ choices=[(item.id, item.name) for item in Country.objects.select_related('exposition_country')\
.order_by('translations__name').distinct()], .filter(exposition_country__country__isnull=False, translations__language_code=translation.get_language())\
required=False, widget=forms.CheckboxSelectMultiple()) .order_by('translations__name').distinct()]
#co = forms.CharField(label=_(u'Страна'), required=False, widget=forms.SelectMultiple()) )
ci = forms.CharField(label=_(u'Город'), required=False, widget=forms.SelectMultiple())
ci = forms.MultipleChoiceField(label=_(u'Город'), required=False, widget=forms.CheckboxSelectMultiple(),
choices=[(item.id, item.name) for item in City.objects.select_related('exposition_city')\
.filter(exposition_city__city__isnull=False, translations__language_code=translation.get_language())\
.order_by('translations__name').distinct()]
)
fr = forms.DateField(required=False, fr = forms.DateField(required=False,
widget=forms.DateInput(attrs={'class': 'date', 'id': 'dateFrom', widget=forms.DateInput(attrs={'class': 'date', 'id': 'dateFrom',
@ -108,60 +115,75 @@ class ExpositionSearchForm(forms.Form):
widget=forms.DateInput(attrs={'class': 'date', 'id': 'dateTo', widget=forms.DateInput(attrs={'class': 'date', 'id': 'dateTo',
'placeholder': _(u'дд.мм.гггг')})) 'placeholder': _(u'дд.мм.гггг')}))
def get_places_display(self): def __init__(self, *args, **kwargs):
display = '' super(ExpositionSearchForm, self).__init__(*args, **kwargs)
self.is_valid() self.theme_classes = {item.id:item.generate_search_class() for item in Theme.objects.all()}
area = self.cleaned_data['area'] """
area_choices = self.fields['area'].choices theme_with_tags = {}
places = [choice[1] for choice in area_choices if str(choice[0]) in area] for tag in list(Tag.objects.language().filter()):
if tag.theme_id in theme_with_tags:
theme_with_tags[tag.theme_id].append({'name': tag.name, 'id':tag.id})
else:
theme_with_tags[tag.theme_id] = [{'name': tag.name, 'id':tag.id}]
country = self.cleaned_data['co']
country_choices = self.fields['co'].choices
places += [choice[1] for choice in country_choices if str(choice[0]) in country]
if not places: #dsds
return _(u'Не важно') self.theme_with_tags = theme_with_tags
return ', '.join(places) """
"""
def clean_area(self):
area = self.cleaned_data.get('area')
if area:
res = ast.literal_eval(area)
return res
return area
def get_places_display(self):
if self.is_valid():
area = self.cleaned_data['area']
area_choices = self.fields['area'].choices
def clean_co(self): places = [choice[1] for choice in area_choices if str(choice[0]) in area]
co = self.cleaned_data.get('co') country = self.cleaned_data['co']
if co: country_choices = self.fields['co'].choices
res = ast.literal_eval(co)
return res
return co
""" places += [choice[1] for choice in country_choices if str(choice[0]) in country]
def clean_ci(self): city = self.cleaned_data['ci']
city_choices = self.fields['ci'].choices
ci = self.cleaned_data.get('ci') places += [choice[1] for choice in city_choices if str(choice[0]) in city]
if ci:
res = ast.literal_eval(ci)
return res
return ci
def clean_th(self):
th = self.cleaned_data.get('th') if not places:
if th: return _(u'Не важно')
res = ast.literal_eval(th) if len(places) == 1:
return res return ', '.join(places)
return th else:
st = _(u' и еще ')+str(len(places)-1)+u' %s'%pytils.numeral.choose_plural(len(places)-1, (_(u"позиция"), _(u"позиции"), _(u"позиций")))
return places[0]+ st
else:
return _(u'Не важно')
def get_themes_display(self):
if self.is_valid():
th = self.cleaned_data['th']
themes_choices = self.fields['th'].choices
themes = [choice[1] for choice in themes_choices if str(choice[0]) in th]
if not themes:
return _(u'Не важно')
if len(themes) == 1:
return ', '.join(themes)
else:
st = _(u' и еще ')+str(len(themes)-1)+u' %s'%pytils.numeral.choose_plural(len(themes)-1, (_(u"позиция"), _(u"позиции"), _(u"позиций")))
return themes[0]+ st
else:
return _(u'Не важно')
def clean_tg(self): def clean_tg(self):
@ -197,17 +219,38 @@ class ExpositionSearchForm(forms.Form):
sqs = sqs.filter(data_begin__gte=fr) sqs = sqs.filter(data_begin__gte=fr)
if to: if to:
sqs = sqs.filter(data_begin__lte=to) sqs = sqs.filter(data_begin__lte=to)
if area:
sqs = sqs.filter(area_id__in=area)
if co:
sqs = sqs.filter(country_id__in=co)
if ci:
sqs = sqs.filter(city_id__in=ci)
if th: if th:
sqs = sqs.filter(theme__in=th) sqs = sqs.filter(theme__in=th)
if tg: if tg:
sqs = sqs.filter(tag__in=tg) sqs = sqs.filter(tag__in=tg)
place_filter = None
if area:
if place_filter:
place_filter = place_filter | Q(area_id__in=area)
else:
place_filter = Q(area_id__in=area)
#sqs = sqs.filter(area_id__in=area)
if co:
if place_filter:
place_filter = place_filter | Q(country_id__in=co)
else:
place_filter = Q(country_id__in=co)
#sqs = sqs.filter(country_id__in=co)
if ci:
if place_filter:
place_filter = place_filter | Q(city_id__in=ci)
else:
place_filter = Q(city_id__in=ci)
#sqs = sqs.filter(city_id__in=ci)
if place_filter:
sqs = sqs.filter(place_filter)
return sqs.order_by('data_begin') return sqs.order_by('data_begin')

@ -285,6 +285,7 @@ class AdminViewObject(FormView):
self.obj = None self.obj = None
def form_valid(self, form): def form_valid(self, form):
self.set_obj()
form.save(obj=self.obj) form.save(obj=self.obj)
return HttpResponseRedirect(self.success_url) return HttpResponseRedirect(self.success_url)
@ -351,10 +352,12 @@ class GalleryView(AdminViewObject):
class PhotoListView(ListView): class PhotoListView(ListView):
paginate_by = settings.ADMIN_PAGINATION
model = Photo model = Photo
template_name = 'photogallery/admin_photo_list.html' template_name = 'photogallery/admin_photo_list.html'
class GalleryListView(ListView): class GalleryListView(ListView):
paginate_by = settings.ADMIN_PAGINATION
model = Gallery model = Gallery
template_name = 'photogallery/admin_gallery_list.html' template_name = 'photogallery/admin_gallery_list.html'

@ -33,11 +33,8 @@ class GalleryForm(forms.Form):
return gallery return gallery
class PhotoForm(forms.Form): class PhotoForm(forms.Form):
image = forms.ImageField(label=u'Изображение') image = forms.ImageField(label=u'Изображение', required=False)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
""" """
@ -52,17 +49,19 @@ class PhotoForm(forms.Form):
# first iteration is a default lang so it required fields # first iteration is a default lang so it required fields
required = True if lid == 0 else False required = True if lid == 0 else False
self.fields['title_%s' % code] = forms.CharField(label='Описание', required=required) self.fields['title_%s' % code] = forms.CharField(label='Описание', required=required)
self.fields['caption_%s' % code] = forms.CharField(label='Заголовок', required=required) self.fields['caption_%s' % code] = forms.CharField(label='Заголовок', required=False)
def save(self, obj=None): def save(self, obj=None):
data = self.cleaned_data data = self.cleaned_data
#create new Photo object or get exists #create new Photo object or get exists
if not obj: if not obj:
photo = Photo() photo = Photo()
photo.image = data['image']
else: else:
photo = obj photo = obj
photo.image = obj.image
photo.image = data['image']
fill_with_signal(Photo, photo, data) fill_with_signal(Photo, photo, data)
return photo return photo

@ -0,0 +1,26 @@
from django.core.management.base import BaseCommand
from photologue.models import PhotoSize
class Command(BaseCommand):
def handle(self, *args, **options):
PhotoSize.objects.create(name='admin_thumbnail',
width=100,
height=75,
crop=True,
pre_cache=True,
increment_count=False)
PhotoSize.objects.create(name='client_thumbnail',
width=256,
height=140,
crop=True,
pre_cache=True,
increment_count=False)
PhotoSize.objects.create(name='display',
width=730,
height=533,
crop=True,
pre_cache=True,
increment_count=True)

@ -159,10 +159,18 @@ IMAGE_FILTERS_HELP_TEXT = _(
'Chain multiple filters using the following pattern "FILTER_ONE->FILTER_TWO->FILTER_THREE". Image filters will be applied in order. The following filters are available: %s.' % (', '.join(filter_names))) 'Chain multiple filters using the following pattern "FILTER_ONE->FILTER_TWO->FILTER_THREE". Image filters will be applied in order. The following filters are available: %s.' % (', '.join(filter_names)))
class UserMark(models.Model):
user = models.ForeignKey('accounts.User', related_name='marks')
top = models.PositiveSmallIntegerField()
left = models.PositiveSmallIntegerField()
height = models.PositiveSmallIntegerField()
width = models.PositiveSmallIntegerField()
@python_2_unicode_compatible @python_2_unicode_compatible
class Gallery(TranslatableModel): class Gallery(TranslatableModel):
translations = TranslatedFields( translations = TranslatedFields(
title = models.CharField(_('title'), max_length=50), title = models.CharField(_('title'), max_length=200),
description = models.TextField(_('description'), blank=True) description = models.TextField(_('description'), blank=True)
) )
date_added = models.DateTimeField(_('date published'), date_added = models.DateTimeField(_('date published'),
@ -170,7 +178,8 @@ class Gallery(TranslatableModel):
slug = models.SlugField(_('title slug'), slug = models.SlugField(_('title slug'),
unique=True, unique=True,
help_text=_('A "slug" is a unique URL-friendly title for an object.')) help_text=_('A "slug" is a unique URL-friendly title for an object.'),
max_length=200)
is_public = models.BooleanField(_('is public'), is_public = models.BooleanField(_('is public'),
default=True, default=True,
@ -681,14 +690,15 @@ class ImageModel(models.Model):
class Photo(TranslatableModel, ImageModel): class Photo(TranslatableModel, ImageModel):
translations = TranslatedFields( translations = TranslatedFields(
title = models.CharField(_('title'), title = models.CharField(_('title'),
max_length=50), max_length=200),
caption = models.TextField(_('caption'), caption = models.TextField(_('caption'),
blank=True) blank=True)
) )
slug = models.SlugField(_('slug'), slug = models.SlugField(_('slug'),
unique=True, unique=True,
help_text=_('A "slug" is a unique URL-friendly title for an object.')) help_text=_('A "slug" is a unique URL-friendly title for an object.'),
max_length=200)
date_added = models.DateTimeField(_('date added'), date_added = models.DateTimeField(_('date added'),
default=now) default=now)
@ -699,6 +709,8 @@ class Photo(TranslatableModel, ImageModel):
sites = models.ManyToManyField(Site, verbose_name=_(u'sites'), sites = models.ManyToManyField(Site, verbose_name=_(u'sites'),
blank=True, null=True) blank=True, null=True)
users = models.ManyToManyField(UserMark, null=True)
objects = PhotologueManager() objects = PhotologueManager()
class Meta: class Meta:
@ -1082,6 +1094,9 @@ def add_default_site(instance, created, **kwargs):
if instance.sites.exists(): if instance.sites.exists():
return return
instance.sites.add(Site.objects.get_current()) instance.sites.add(Site.objects.get_current())
post_save.connect(add_default_site, sender=Gallery) post_save.connect(add_default_site, sender=Gallery)
post_save.connect(add_default_site, sender=Photo) post_save.connect(add_default_site, sender=Photo)

@ -3,19 +3,7 @@ from django.db import models
from django.db.models.signals import post_save from django.db.models.signals import post_save
from hvad.models import TranslatableModel, TranslatedFields from hvad.models import TranslatableModel, TranslatedFields
from django.contrib.contenttypes import generic from django.contrib.contenttypes import generic
from functions.signal_handlers import post_save_handler
from accounts.models import User
from company.models import Company
from django.contrib.contenttypes import generic
from django.db.models.signals import post_save from django.db.models.signals import post_save
# models
from directories.models import Language, Currency
from city.models import City
from service.models import Service
# func
from functions.custom_fields import EnumField
from bitfield import BitField
from functions.db import db_table_exists
from functions.signal_handlers import post_save_handler from functions.signal_handlers import post_save_handler

@ -185,6 +185,75 @@ def exposition_change(request, url):
args['files'] = FileModel.objects.filter(content_type=ContentType.objects.get_for_model(place), args['files'] = FileModel.objects.filter(content_type=ContentType.objects.get_for_model(place),
object_id=getattr(place, 'id')) object_id=getattr(place, 'id'))
args['obj_id'] = exposition_id args['obj_id'] = exposition_id
args['object'] = place
return render_to_response('place_exposition_add.html', args)
#test----------------------
from functions.admin_views import AdminView
class PlaceExpositionView(AdminView):
form_class = ExpositionForm
model = PlaceExposition
success_url = 'admin/place_exposition/all/'
template_name = 'admin/place_exposition/place_exposition.html'
def get_form(self, form_class):
if self.request.POST:
return super(PlaceExpositionView, self).get_form(form_class)
obj = self.set_obj()
if obj:
data = {'type': obj.type, 'address': obj.address,
'phone': obj.phone, 'fax': obj.fax, 'web_page': obj.web_page, 'email': obj.email,
'foundation_year': obj.foundation_year, 'total_area': obj.total_area,
'closed_area': obj.closed_area, 'open_area': obj.open_area,
'total_pavilions': obj.total_pavilions, 'total_halls': obj.total_halls, 'wifi':obj.wifi,
'bank': obj.bank, 'children_room': obj.children_room, 'video_link': obj.video_link,
'disabled_service': obj.disabled_service, 'conference_centre': obj.conference_centre,
'business_centre': obj.business_centre, 'online_registration': obj.online_registration,
'cafe': obj.cafe, 'terminals': obj.terminals, 'parking': obj.parking,
'press_centre': obj.press_centre, 'mobile_application': obj.mobile_application,
'place_exposition_id':obj.id}
data['country'] = obj.country_id
data['city'] = obj.city_id
for code, name in settings.LANGUAGES:
trans_obj = self.model._meta.translations_model.objects.get(language_code = code,master__id=obj.id) #access to translated fields
data['name_%s'%code] = trans_obj.name
data['main_title_%s'%code] = trans_obj.main_title
data['description_%s'%code] = trans_obj.description
data['adress_%s'%code] = trans_obj.adress
data['total_year_action_%s'%code] = trans_obj.total_year_action
data['title_%s'%code] = trans_obj.title
data['keywords_%s'%code] = trans_obj.keywords
data['descriptions_%s'%code] = trans_obj.descriptions
form =form_class(initial=data)
form.fields['city'].widget.attrs['data-init-text'] = obj.city.name
return form
else:
return form_class()
def halls(self):
obj = self.set_obj()
if obj:
HallFormSet = modelformset_factory(Hall, form=HallForm, exclude=('place_exposition',))
#get existing halls
halls = Hall.objects.filter(place_exposition=getattr(obj, 'id'))
#fill HallFormSet
formset = HallFormSet(queryset=halls)
else:
HallFormSet = formset_factory(HallForm)
formset = HallFormSet()
return formset
def get_context_data(self, **kwargs):
context = super(PlaceExpositionView, self).get_context_data(**kwargs)
context['formset'] = self.halls()
return context
return render_to_response('place_exposition_add.html', args)

@ -1,10 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from admin import PlaceExpositionView
urlpatterns = patterns('place_exposition.admin', urlpatterns = patterns('place_exposition.admin',
url(r'^all/$', 'exposition_all'),
url(r'^add.*/$', 'exposition_add'), url(r'^add.*/$', 'exposition_add'),
url(r'^delete/(?P<url>.*)/$', 'exposition_delete'), url(r'^delete/(?P<url>.*)/$', 'exposition_delete'),
url(r'^change/(?P<url>.*)/$', 'exposition_change'), url(r'^change/(?P<url>.*)/$', 'exposition_change'),
url(r'^copy/(?P<url>.*)/$', 'place_exposition_copy'), url(r'^copy/(?P<url>.*)/$', 'place_exposition_copy'),
url(r'^all/$', 'exposition_all'), url(r'^$', PlaceExpositionView.as_view()),
url(r'^(?P<url>.*)/$', PlaceExpositionView.as_view()),
) )

@ -291,4 +291,7 @@ class HallForm(forms.ModelForm):
def clean_capacity(self): def clean_capacity(self):
cleaned_data = super(HallForm, self).clean() cleaned_data = super(HallForm, self).clean()
capacity = cleaned_data.get('capacity').strip() capacity = cleaned_data.get('capacity').strip()
return is_positive_integer(capacity, 'Вместимость должна состоять из цифр') return is_positive_integer(capacity, 'Вместимость должна состоять из цифр')
class TestForm(forms.Form):
pass

@ -0,0 +1,61 @@
from django.core.management.base import BaseCommand, CommandError
from place_exposition.models import PlaceExposition
from django.contrib.sites.models import Site
from photologue.models import Gallery, Photo
from file.models import FileModel
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile
import urllib2
from django.conf import settings
#img_temp = NamedTemporaryFile(delete=True)
#img_temp.write(urllib2.urlopen(url).read())
#img_temp.flush()
#im.file.save(img_filename, File(img_temp))
def convert_photo(photo):
domain = 'http://hit.expomap.ru'
url = domain+photo.file_path.url
file_name = url.split('/')[-1]
download_to = settings.MEDIA_ROOT+'photologue/'+file_name
try:
response = urllib2.urlopen(url, timeout=5)
except:
print('download error')
return None
with open(download_to,'wb') as f:
f.write(response.read())
f.close()
file_name = 'photologue/'+file_name
new_photo = Photo(image=file_name)
new_photo.translate('en')
new_photo.title = file_name.replace('photologue/', '')
new_photo.save()
return new_photo
def handle_place(place):
domain = 'http://hit.expomap.ru'
for photo in list(place.photos.all()):
new_photo = convert_photo(photo)
place.upload_photo(new_photo)
print(place)
class Command(BaseCommand):
def handle(self, *args, **options):
for place in PlaceExposition.objects.all('en'):
if place.photos.all().exists():
handle_place(place)
"""
url = 'adnec-abu-dhabi-national-exhibitions-center'
p = PlaceExposition.objects.get(url=url)
handle_place(p)
"""

@ -5,6 +5,8 @@ from django.contrib.contenttypes import generic
from django.db.models.signals import post_save, pre_save from django.db.models.signals import post_save, pre_save
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from functools import partial from functools import partial
from django.conf import settings
from functions.translate import fill_with_signal
# #
from hvad.models import TranslatableModel, TranslatedFields, TranslationManager from hvad.models import TranslatableModel, TranslatedFields, TranslationManager
@ -17,6 +19,7 @@ from functions.model_mixin import ExpoMixin
from exposition.models import Exposition from exposition.models import Exposition
from place_conference.models import PlaceConference from place_conference.models import PlaceConference
from photologue.models import Gallery
EXPOSITION_TYPE = (('Exposition complex', u'Выставочный комплекс'), ('Convention centre', u'Конгрессно-выставочный центр'), EXPOSITION_TYPE = (('Exposition complex', u'Выставочный комплекс'), ('Convention centre', u'Конгрессно-выставочный центр'),
('Exposition centre', u'Выставочный центр'),) ('Exposition centre', u'Выставочный центр'),)
@ -36,6 +39,7 @@ class PlaceExposition(TranslatableModel, ExpoMixin):
url = models.SlugField(unique=True, max_length=255) url = models.SlugField(unique=True, max_length=255)
country = models.ForeignKey('country.Country', on_delete=models.PROTECT) country = models.ForeignKey('country.Country', on_delete=models.PROTECT)
photogallery = models.ForeignKey('photologue.Gallery', null=True, blank=True)
city = models.ForeignKey('city.City', on_delete=models.PROTECT, related_name='place_expositions') city = models.ForeignKey('city.City', on_delete=models.PROTECT, related_name='place_expositions')
#type uses EnumField for creating Enum type field in Mysql database #type uses EnumField for creating Enum type field in Mysql database
type = EnumField(values = [item1 for item1, item2 in EXPOSITION_TYPE]) type = EnumField(values = [item1 for item1, item2 in EXPOSITION_TYPE])
@ -95,6 +99,37 @@ class PlaceExposition(TranslatableModel, ExpoMixin):
class Meta: class Meta:
ordering = ['translations__name'] ordering = ['translations__name']
def get_gallery(self):
if self.photogallery:
return self.photogallery
data = {}
model = type(self)
for code, name in settings.LANGUAGES:
obj = model._meta.translations_model.objects.get(language_code = code,master__id=self.id) #access to translated fields
data['title_%s'%code] = obj.name
data['description_%s'%code] = obj.description
gallery = Gallery()
fill_with_signal(Gallery, gallery, data)
self.photogallery = gallery
self.save()
return gallery
def upload_photo(self, photo ,gallery=None):
"""
uploading photo to gallery
"""
if gallery is None:
gallery = self.get_gallery()
gallery.photos.add(photo)
def get_index_text(self): def get_index_text(self):
names = [tr.name for tr in self.translations.all()] names = [tr.name for tr in self.translations.all()]
return names return names

@ -18,13 +18,12 @@ MANAGERS = ADMINS
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'ENGINE': 'django.db.backends.mysql',
'NAME': 'test', # Or path to database file if using sqlite3. 'NAME': 'test2',
# The following settings are not used with sqlite3: 'USER': 'kotzilla',
'USER': 'root',
'PASSWORD': 'qazedc', 'PASSWORD': 'qazedc',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'HOST': '',
'PORT': '', # Set to empty string for default. 'PORT': '',
} }
} }
''' '''
@ -161,6 +160,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
# 'django.middleware.cache.UpdateCacheMiddleware', # 'django.middleware.cache.UpdateCacheMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware', 'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
@ -173,8 +173,10 @@ MIDDLEWARE_CLASSES = (
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',#должно быть последним полем 'debug_toolbar.middleware.DebugToolbarMiddleware',#должно быть последним полем
) )
ROOT_URLCONF = 'proj.urls' ROOT_URLCONF = 'proj.urls'
# Python dotted path to the WSGI application used by Django's runserver. # Python dotted path to the WSGI application used by Django's runserver.
@ -339,9 +341,12 @@ INSTALLED_APPS = (
'password_reset', 'password_reset',
#'social_auth', #'social_auth',
'social.apps.django_app.default', 'social.apps.django_app.default',
'south', # 'south',
#'debug_toolbar', # 'debug_toolbar',
) )
#INTERNAL_IPS = ('176.121.5.82',)
#DEBUG_TOOLBAR_PATCH_SETTINGS = False
# search backend # search backend
HAYSTACK_CONNECTIONS = { HAYSTACK_CONNECTIONS = {
@ -389,10 +394,11 @@ CALLBACK_EMAIL = 'kotzilla@ukr.net'
BOOKING_AID = '333667' BOOKING_AID = '333667'
"""
try: try:
from local import * from local import *
except ImportError, e: except ImportError, e:
from production import * from production import *
"""
ADMIN_PAGINATION = 20
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG

@ -6,11 +6,11 @@ from core.simple_index_view import AdvertisingView, AboutView
from views import MainPageView from views import MainPageView
from django.http import HttpResponse from django.http import HttpResponse
def robots(request): def check_forward(request, *args, **kwargs):
return HttpResponse('User-agent: * \nDisallow: /', content_type='text/plain') return HttpResponse(request.META.get('HTTP_X_FORWARDED_FOR', None))
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^robots.txt$', robots), url(r'^bla/$', check_forward),
url(r'^$', MainPageView.as_view()), url(r'^$', MainPageView.as_view()),
url(r'^theme/', include('theme.urls')), url(r'^theme/', include('theme.urls')),
url(r'^', include('accounts.urls')), url(r'^', include('accounts.urls')),
@ -37,6 +37,7 @@ urlpatterns = patterns('',
url(r'^contacts/$', AboutView.as_view()), url(r'^contacts/$', AboutView.as_view()),
url(r'^events/search/$', EventSearchView.as_view()), url(r'^events/search/$', EventSearchView.as_view()),
url(r'^places/search/$', PlaceSearchView.as_view()), url(r'^places/search/$', PlaceSearchView.as_view()),
url(r'^places/(?P<params>.*)/photo/(?P<page>\d+)/$', PlacePhotoView.as_view()),
url(r'^places/(?P<params>.*)/photo/$', PlacePhotoView.as_view()), url(r'^places/(?P<params>.*)/photo/$', PlacePhotoView.as_view()),
url(r'^places/(?P<params>.*)/(?P<page>\d+)/$', PlaceListView.as_view()), url(r'^places/(?P<params>.*)/(?P<page>\d+)/$', PlaceListView.as_view()),
url(r'^places/(?P<page>\d+)/$', PlaceListView.as_view()), url(r'^places/(?P<page>\d+)/$', PlaceListView.as_view()),
@ -72,8 +73,10 @@ urlpatterns += patterns('',
# url(r'^profile/change-password/', 'accounts.views.change_password'), # url(r'^profile/change-password/', 'accounts.views.change_password'),
) )
if settings.DEBUG: if settings.DEBUG:
import debug_toolbar import debug_toolbar
urlpatterns += patterns('', urlpatterns += patterns('',
url(r'^__debug__/', include(debug_toolbar.urls)), url(r'^__debug__/', include(debug_toolbar.urls)),
) )

@ -14,6 +14,10 @@ from photoreport.models import Photoreport
register = template.Library() register = template.Library()
@register.filter
def get_item(dictionary, key):
return dictionary.get(key)
@register.filter @register.filter
def phone(value): # Only one argument. def phone(value): # Only one argument.
"""Converts a string into all lowercase""" """Converts a string into all lowercase"""
@ -60,8 +64,10 @@ def generate_url(value, arg=None):
if models.get(item.get('url')): if models.get(item.get('url')):
result.append(models.get(item.get('url'))) result.append(models.get(item.get('url')))
else: else:
if item.get('url'):
result.append(item.get('type')+'-'+item.get('url')) result.append(item.get('type')+'-'+item.get('url'))
else:
result.append(item.get('type'))
if item.get('type') == arg: if item.get('type') == arg:
return '/'.join(result) return '/'.join(result)

@ -0,0 +1 @@
/home/www/proj/templates/client/static_client

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Before

Width:  |  Height:  |  Size: 448 KiB

After

Width:  |  Height:  |  Size: 448 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save