Photogallery fix

remotes/origin/1203
Nazar Kotjuk 10 years ago
parent db56241d66
commit e38616cc03
  1. 2
      conference/admin.py
  2. 24
      conference/models.py
  3. 4
      conference/urls.py
  4. 26
      conference/views.py
  5. 29
      exposition/admin.py
  6. 45
      exposition/models.py
  7. 8
      exposition/urls.py
  8. 24
      exposition/views.py
  9. 33
      functions/model_mixin.py
  10. 22
      functions/signal_handlers.py
  11. 12
      import_xls/models.py
  12. 250
      photologue/admin.py
  13. 2
      photologue/client_urls.py
  14. 9
      photologue/forms.py
  15. 22
      photologue/models.py
  16. 2
      place_exposition/models.py
  17. 11
      place_exposition/views.py
  18. 7
      templates/admin/includes/photo_form.html
  19. 5
      templates/admin/photogallery/admin_gallery.html
  20. 8
      templates/admin/photogallery/admin_photo.html
  21. 10
      templates/admin/photogallery/admin_photo_list.html
  22. 26
      templates/client/conference/photo.html
  23. 219
      templates/client/exposition/exposition_price.html
  24. 134
      templates/client/exposition/exposition_programm.html
  25. 170
      templates/client/exposition/exposition_statistic.html
  26. 17
      templates/client/exposition/expositiontranslation_list.html
  27. 26
      templates/client/exposition/photo.html
  28. 29
      templates/client/exposition/programm.html
  29. 3
      templates/client/includes/conference/conference_object.html
  30. 79
      templates/client/includes/conference/photo.html
  31. 4
      templates/client/includes/exposition/expo_paid.html
  32. 4
      templates/client/includes/exposition/exposition_object.html
  33. 79
      templates/client/includes/exposition/photo.html
  34. 2
      templates/client/includes/exposition/programm.html
  35. 4
      templates/client/includes/exposition/statistic.html
  36. 47
      templates/client/includes/paginator.html
  37. 17
      templates/client/includes/place/photo.html

@ -272,7 +272,6 @@ class ConferenceView(AdminView):
else:
return form_class()
def get_context_data(self, **kwargs):
context = super(ConferenceView, self).get_context_data(**kwargs)
obj = self.set_obj()
@ -294,6 +293,7 @@ class ConferenceListView(AdminListView):
form_class = ConferenceFilterForm
model = Conference
def upload_conference_photo(request, conf_id):
return upload_photo(request, conf_id, Conference)

@ -68,7 +68,7 @@ class Conference(TranslatableModel, EventMixin, ExpoMixin):
blank=True, null=True, related_name='conference_companies')
users = models.ManyToManyField('accounts.User', verbose_name='Посетители выставки',
blank=True, null=True, related_name='conference_users')
photogallery = models.ForeignKey('photologue.Gallery', blank=True, null=True)
photogallery = models.ForeignKey('photologue.Gallery', blank=True, null=True, on_delete=models.SET_NULL)
logo = models.ImageField(verbose_name='Logo', upload_to='conference/logo/', blank=True)
rating = models.IntegerField(default=0, db_index=True) # добавить индекс в базе
@ -152,7 +152,6 @@ class Conference(TranslatableModel, EventMixin, ExpoMixin):
else:
return []
def get_catalog_url(self):
return '/conference/'
@ -195,25 +194,8 @@ class Conference(TranslatableModel, EventMixin, ExpoMixin):
tags = ' '.join([' '.join(tag.get_all_names()) for tag in self.tag.all()])
return names + ' ' + titles + ' ' + themes + ' ' + tags
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_url(self):
return '/admin/conference/upload-photo/%s/' % self.id
class Statistic(TranslatableModel):

@ -2,7 +2,7 @@
from django.conf.urls import patterns, include, url
from views import ConferenceDetail, ConferenceList, ConferenceByCity, ConferenceByCountry, ConferenceByTheme,\
ConferenceCountryCatalog, ConferenceCityCatalog, ConferenceTagCatalog, ConferenceThemeCatalog, ConferenceMembers,\
ConferenceVisitors, ConferenceServiceView, ConferenceThankView, ConferenceByTag
ConferenceVisitors, ConferenceServiceView, ConferenceThankView, ConferenceByTag, ConferencePhotoView
from exposition.views import ExpositionSearchView
urlpatterns = patterns('',
@ -61,6 +61,8 @@ urlpatterns = patterns('',
url(r'conference/tag/(?P<slug>.*)/(?P<year>\d+)/$', ConferenceTagCatalog.as_view(), {'meta_id':33}),
url(r'conference/tag/(?P<slug>.*)/$', ConferenceTagCatalog.as_view(), {'meta_id':32}),
# conf additional pages
url(r'^conference/(?P<slug>.*)/photo/page/(?P<page>\d+)/$', ConferencePhotoView.as_view()),
url(r'^conference/(?P<slug>.*)/photo/$', ConferencePhotoView.as_view()),
url(r'conference/(?P<slug>.*)/visitors/page/(?P<page>\d+)/$', ConferenceVisitors.as_view()),
url(r'conference/(?P<slug>.*)/visitors/$', ConferenceVisitors.as_view()),
url(r'conference/(?P<slug>.*)/members/page/(?P<page>\d+)/$', ConferenceMembers.as_view()),

@ -28,7 +28,7 @@ MONTHES = settings.MONTHES
class ConferenceBy(JitterCacheMixin, MetadataMixin, ListView):
cache_range = settings.CACHE_RANGE
template_name = 'conference/conference_by.html'
template_name = 'client/conference/conference_by.html'
title1 = ''
title2 = ''
@ -437,6 +437,30 @@ class ConferenceList(MetadataMixin, JitterCacheMixin, ListView):
return context
class ConferencePhotoView(MetadataMixin, ListView):
template_name = 'client/conference/photo.html'
obj = None
paginate_by = settings.CLIENT_PAGINATION
def get_queryset(self):
slug = self.kwargs.get('slug')
conf = get_object_or_404(Conference, url=slug)
self.obj = conf
if conf.photogallery:
return conf.photogallery.photos.all()
else:
raise Http404()
def get_context_data(self, **kwargs):
context = super(ConferencePhotoView, self).get_context_data(**kwargs)
obj = self.obj
context['object'] = obj
context['city'] = str(obj.city_id)
context['country'] = str(obj.country_id)
context['themes'] = [str(item.id) for item in obj.theme.all()]
return context
def conference_add_calendar(request, id):
args = {'success': False}
user = request.user

@ -243,22 +243,8 @@ class ExpositionView(AdminView):
template_name = 'admin/exposition/exposition.html'
def form_valid(self, form):
#StatisticFormSet = formset_factory(StatisticForm)
#formset_statistic = StatisticFormSet(self.request.POST)
self.set_obj()
expo = form.save(obj=self.obj)
"""
# delete old halls
Statistic.objects.filter(exposition=getattr(expo, 'id')).delete()
for item in formset_statistic.forms:
# saves new statistic if its valid and not empty
if item.is_valid() and item.has_changed():
statistic = item.save(commit=False)
statistic.exposition = expo
statistic.save()
"""
return HttpResponseRedirect(self.success_url)
def get_form(self, form_class):
@ -321,35 +307,22 @@ class ExpositionView(AdminView):
data['keywords_%s' % code] = trans_obj.keywords
data['descriptions_%s' % code] = trans_obj.descriptions
form =form_class(initial=data)
form = form_class(initial=data)
form.fields['city'].widget.attrs['data-init-text'] = obj.city.name
form.fields['tag'].choices = [(item.id, item.name) for item in Tag.objects.language().filter(theme__in=data['theme'])]
return form
else:
return form_class()
def get_context_data(self, **kwargs):
context = super(ExpositionView, self).get_context_data(**kwargs)
obj = self.set_obj()
if obj:
#StatisticFormSet = modelformset_factory(Statistic, form=StatisticForm, exclude=('exposition',))
# get existing statistic
#statistic = Statistic.objects.filter(exposition=getattr(obj, 'id'))
# fill HallFormSet
#formset_statistic = StatisticFormSet(queryset=statistic)
context['stat_form'] = StatisticForm()
context['file_form'] = FileForm(initial={'model': 'exposition.Exposition'})
files = FileModel.objects.filter(content_type=ContentType.objects.get_for_model(obj),object_id=getattr(obj, 'id'))
context['files'] = files
else:
#StatisticFormSet = formset_factory(StatisticForm)
#formset_statistic = StatisticFormSet()
pass
#context['formset_statistic'] = formset_statistic
context['photo_form'] = PhotoForm()
context['timetable_form'] = TimeTableForm()
context['timetables'] = TimeTable.objects.filter(exposition=obj)

@ -17,8 +17,7 @@ from functions.custom_fields import EnumField
from functions.signal_handlers import post_save_handler, pre_save_handler
from functions.models_methods import ExpoManager
from functions.model_mixin import EventMixin, ExpoMixin
from functions.translate import fill_with_signal
from photologue.models import Gallery
from import_xls.model_utils import ExpoImportManager
from functions.models_methods import hvad_to_dict
@ -80,7 +79,7 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
blank=True, null=True, related_name='exposition_companies')
users = models.ManyToManyField('accounts.User', verbose_name='Посетители выставки',
blank=True, null=True, related_name='exposition_users')
photogallery = models.ForeignKey('photologue.Gallery', blank=True, null=True)
photogallery = models.ForeignKey('photologue.Gallery', blank=True, null=True, on_delete=models.SET_NULL)
logo = models.ImageField(verbose_name='Logo', upload_to='exposition/logo/', blank=True)
rating = models.IntegerField(default=0) # добавить индекс в базе
@ -209,28 +208,7 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
return ''
def upload_photo_url(self):
return '/admin/exposition/upload-photo/%s/'%self.id
def get_gallery(self):
if self.photogallery:
return self.photogallery
data = {}
model = type(self)
for code, name in settings.LANGUAGES:
# access to translated fields
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
return '/admin/exposition/upload-photo/%s/' % self.id
def tags(self):
return self.tag.language().all()
@ -238,21 +216,6 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
def statistic_exists(self):
return Statistic.objects.filter(exposition=self).exists()
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):
# names = [tr.name for tr in self.translations.all()]
# return names
def get_audience(self):
checked = [item for item, bool in self.audience if bool==True]
audience = []
@ -343,7 +306,7 @@ class TimeTable(TranslatableModel):
TimeTable for business program
"""
exposition = models.ForeignKey(Exposition, related_name='business_program')
exposition = models.ForeignKey(Exposition, related_name='TimeTable')
begin = models.DateTimeField(verbose_name='Начало')
end = models.DateTimeField(verbose_name='Конец')
timetable_organiser = models.ForeignKey(Organiser, null=True, blank=True)

@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from views import ExpositionStatistic, ExpositionPrice,\
ExpositionProgramme, ExpositionSearchView, ExpositionByCountry, ExpositionByTheme, ExpositionByCity, ExpositionByTag
from views import ExpositionStatistic, ExpositionPrice, ExpositionProgramme, ExpositionSearchView, \
ExpositionByCountry, ExpositionByTheme, ExpositionByCity, ExpositionByTag, ExpoPhotoView
from django.views.decorators.cache import cache_page
from views import ExpositionServiceView
from views import ExpoCountryCatalog, ExpoCityCatalog, ExpoThemeCatalog, ExpoTagCatalog, ExpoList, ExpoDetail,\
ExpoVisitors, ExpoMembers, ExpositionThankView
@ -69,6 +67,8 @@ urlpatterns = patterns('',
url(r'^expo/(?P<slug>.*)/program/$', ExpositionProgramme.as_view(), {'meta_id':62}),
url(r'^expo/(?P<slug>.*)/visitors/page/(?P<page>\d+)/$', ExpoVisitors.as_view(), {'meta_id':64}),
url(r'^expo/(?P<slug>.*)/visitors/$', ExpoVisitors.as_view(), {'meta_id':64}),
url(r'^expo/(?P<slug>.*)/photo/page/(?P<page>\d+)/$', ExpoPhotoView.as_view()),
url(r'^expo/(?P<slug>.*)/photo/$', ExpoPhotoView.as_view()),
url(r'^expo/(?P<slug>.*)/members/page/(?P<page>\d+)/$', ExpoMembers.as_view(), {'meta_id':63}),
url(r'^expo/(?P<slug>.*)/members/$', ExpoMembers.as_view(), {'meta_id':63}),
url(r'^expo/(?P<slug>.*)/service/thanks/', ExpositionThankView.as_view()),

@ -548,6 +548,30 @@ class ExpoMembers(MetadataMixin, ListView):
return context
class ExpoPhotoView(MetadataMixin, ListView):
template_name = 'client/exposition/photo.html'
obj = None
paginate_by = settings.CLIENT_PAGINATION
def get_queryset(self):
slug = self.kwargs.get('slug')
expo = get_object_or_404(Exposition, url=slug)
self.obj = expo
if expo.photogallery:
return expo.photogallery.photos.all()
else:
raise Http404()
def get_context_data(self, **kwargs):
context = super(ExpoPhotoView, self).get_context_data(**kwargs)
obj = self.obj
context['object'] = obj
context['city'] = str(obj.city_id)
context['country'] = str(obj.country_id)
context['themes'] = [str(item.id) for item in obj.theme.all()]
return context
def add_note(request, slug):
args = {'success': False}

@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
import copy
from django.conf import settings
from functions.translate import fill_with_signal
import calendar as python_calendar
from service.models import Service
from photologue.models import Gallery
class ExpoMixin(object):
@ -103,6 +106,36 @@ class EventMixin(object):
return 0
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_gallery(self):
if self.photogallery:
return self.photogallery
data = {}
model = type(self)
for code, name in settings.LANGUAGES:
# access to translated fields
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 copy(self, url):
"""
Copy event with new url

@ -1,5 +1,7 @@
import random
import string
from django.db.models.fields.files import FieldFile
from signal_additional_func import fill_missing_languages, fill_meta_information
import random, string
from functions.form_check import translit_with_separator
@ -34,14 +36,14 @@ def post_save_handler(sender, **kwargs):
fill_missing_languages(obj)
fill_meta_information(obj)
'''
def post_save_translation_handler(sender, **kwargs):
def file_cleanup(sender, instance, *args, **kwargs):
"""
receiver function
take object and change url
Deletes the file(s) associated with a model instance. The model
is not saved after deletion of the file(s) since this is meant
to be used with the pre_delete signal.
"""
obj = kwargs['instance']
if obj.language_code == 'ru':
obj.master.url = translit_with_separator(obj.name)
obj.master.save()
'''
for field_name, _ in instance.__dict__.iteritems():
field = getattr(instance, field_name)
if issubclass(field.__class__, FieldFile) and field.name:
field.delete(save=False)

@ -3,23 +3,13 @@ from django.db import models
from django.conf import settings
from django.db.models.fields.files import FieldFile
from django.db.models.signals import pre_delete
from functions.signal_handlers import file_cleanup
def get_doc_dir(instance, filename):
from pytils import translit
return u'import_xls/import/%s' %translit.translify(filename)
def file_cleanup(sender, instance, *args, **kwargs):
'''
Deletes the file(s) associated with a model instance. The model
is not saved after deletion of the file(s) since this is meant
to be used with the pre_delete signal.
'''
for field_name, _ in instance.__dict__.iteritems():
field = getattr(instance, field_name)
if issubclass(field.__class__, FieldFile) and field.name:
field.delete(save=False)
class LogManager(models.Manager):
def create_log(self, work_file, errors):
"""

@ -14,247 +14,6 @@ MULTISITE = getattr(settings, 'PHOTOLOGUE_MULTISITE', False)
ENABLE_TAGS = getattr(settings, 'PHOTOLOGUE_ENABLE_TAGS', False)
"""
class GalleryAdminForm(forms.ModelForm):
class Meta:
model = Gallery
if MULTISITE:
exclude = []
else:
exclude = ['sites']
if not ENABLE_TAGS:
exclude.append('tags')
class GalleryAdmin(admin.ModelAdmin):
list_display = ('title', 'date_added', 'photo_count', 'is_public')
list_filter = ['date_added', 'is_public']
if MULTISITE:
list_filter.append('sites')
date_hierarchy = 'date_added'
prepopulated_fields = {'slug': ('title',)}
form = GalleryAdminForm
if MULTISITE:
filter_horizontal = ['sites']
if MULTISITE:
actions = [
'add_to_current_site',
'add_photos_to_current_site',
'remove_from_current_site',
'remove_photos_from_current_site'
]
def formfield_for_manytomany(self, db_field, request, **kwargs):
''' Set the current site as initial value. '''
if db_field.name == "sites":
kwargs["initial"] = [Site.objects.get_current()]
return super(GalleryAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)
def save_related(self, request, form, *args, **kwargs):
'''
If the user has saved a gallery with a photo that belongs only to
different Sites - it might cause much confusion. So let them know.
'''
super(GalleryAdmin, self).save_related(request, form, *args, **kwargs)
orphaned_photos = form.instance.orphaned_photos()
if orphaned_photos:
msg = ungettext(
'The following photo does not belong to the same site(s)'
' as the gallery, so will never be displayed: %(photo_list)s.',
'The following photos do not belong to the same site(s)'
' as the gallery, so will never be displayed: %(photo_list)s.',
len(orphaned_photos)
) % {'photo_list': ", ".join([photo.title for photo in orphaned_photos])}
messages.warning(request, msg)
def add_to_current_site(modeladmin, request, queryset):
current_site = Site.objects.get_current()
current_site.gallery_set.add(*queryset)
msg = ungettext(
"The gallery has been successfully added to %(site)s",
"The galleries have been successfully added to %(site)s",
len(queryset)
) % {'site': current_site.name}
messages.success(request, msg)
add_to_current_site.short_description = \
_("Add selected galleries from the current site")
def remove_from_current_site(modeladmin, request, queryset):
current_site = Site.objects.get_current()
current_site.gallery_set.remove(*queryset)
msg = ungettext(
"The gallery has been successfully removed from %(site)s",
"The selected galleries have been successfully removed from %(site)s",
len(queryset)
) % {'site': current_site.name}
messages.success(request, msg)
remove_from_current_site.short_description = \
_("Remove selected galleries from the current site")
def add_photos_to_current_site(modeladmin, request, queryset):
photos = Photo.objects.filter(galleries__in=queryset)
current_site = Site.objects.get_current()
current_site.photo_set.add(*photos)
msg = ungettext(
'All photos in gallery %(galleries)s have been successfully added to %(site)s',
'All photos in galleries %(galleries)s have been successfully added to %(site)s',
len(queryset)
) % {
'site': current_site.name,
'galleries': ", ".join(["'{0}'".format(gallery.title)
for gallery in queryset])
}
messages.success(request, msg)
add_photos_to_current_site.short_description = \
_("Add all photos of selected galleries to the current site")
def remove_photos_from_current_site(modeladmin, request, queryset):
photos = Photo.objects.filter(galleries__in=queryset)
current_site = Site.objects.get_current()
current_site.photo_set.remove(*photos)
msg = ungettext(
'All photos in gallery %(galleries)s have been successfully removed from %(site)s',
'All photos in galleries %(galleries)s have been successfully removed from %(site)s',
len(queryset)
) % {
'site': current_site.name,
'galleries': ", ".join(["'{0}'".format(gallery.title)
for gallery in queryset])
}
messages.success(request, msg)
remove_photos_from_current_site.short_description = \
_("Remove all photos in selected galleries from the current site")
admin.site.register(Gallery, GalleryAdmin)
class GalleryUploadAdmin(admin.ModelAdmin):
def has_change_permission(self, request, obj=None):
return False # To remove the 'Save and continue editing' button
def save_model(self, request, obj, form, change):
# Warning the user when things go wrong in a zip upload.
obj.request = request
obj.save()
admin.site.register(GalleryUpload, GalleryUploadAdmin)
class PhotoAdminForm(forms.ModelForm):
class Meta:
model = Photo
if MULTISITE:
exclude = []
else:
exclude = ['sites']
if not ENABLE_TAGS:
exclude.append('tags')
class PhotoAdmin(admin.ModelAdmin):
list_display = ('title', 'date_taken', 'date_added',
'is_public', 'tags', 'view_count', 'admin_thumbnail')
list_filter = ['date_added', 'is_public']
if MULTISITE:
list_filter.append('sites')
search_fields = ['title', 'slug', 'caption']
list_per_page = 10
prepopulated_fields = {'slug': ('title',)}
form = PhotoAdminForm
if MULTISITE:
filter_horizontal = ['sites']
if MULTISITE:
actions = ['add_photos_to_current_site', 'remove_photos_from_current_site']
def formfield_for_manytomany(self, db_field, request, **kwargs):
''' Set the current site as initial value. '''
if db_field.name == "sites":
kwargs["initial"] = [Site.objects.get_current()]
return super(PhotoAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)
def add_photos_to_current_site(modeladmin, request, queryset):
current_site = Site.objects.get_current()
current_site.photo_set.add(*queryset)
msg = ungettext(
'The photo has been successfully added to %(site)s',
'The selected photos have been successfully added to %(site)s',
len(queryset)
) % {'site': current_site.name}
messages.success(request, msg)
add_photos_to_current_site.short_description = \
_("Add selected photos to the current site")
def remove_photos_from_current_site(modeladmin, request, queryset):
current_site = Site.objects.get_current()
current_site.photo_set.remove(*queryset)
msg = ungettext(
'The photo has been successfully removed from %(site)s',
'The selected photos have been successfully removed from %(site)s',
len(queryset)
) % {'site': current_site.name}
messages.success(request, msg)
remove_photos_from_current_site.short_description = \
_("Remove selected photos from the current site")
admin.site.register(Photo, PhotoAdmin)
class PhotoEffectAdmin(admin.ModelAdmin):
list_display = ('name', 'description', 'color', 'brightness',
'contrast', 'sharpness', 'filters', 'admin_sample')
fieldsets = (
(None, {
'fields': ('name', 'description')
}),
('Adjustments', {
'fields': ('color', 'brightness', 'contrast', 'sharpness')
}),
('Filters', {
'fields': ('filters',)
}),
('Reflection', {
'fields': ('reflection_size', 'reflection_strength', 'background_color')
}),
('Transpose', {
'fields': ('transpose_method',)
}),
)
admin.site.register(PhotoEffect, PhotoEffectAdmin)
class PhotoSizeAdmin(admin.ModelAdmin):
list_display = ('name', 'width', 'height', 'crop', 'pre_cache', 'effect', 'increment_count')
fieldsets = (
(None, {
'fields': ('name', 'width', 'height', 'quality')
}),
('Options', {
'fields': ('upscale', 'crop', 'pre_cache', 'increment_count')
}),
('Enhancements', {
'fields': ('effect', 'watermark',)
}),
)
admin.site.register(PhotoSize, PhotoSizeAdmin)
class WatermarkAdmin(admin.ModelAdmin):
list_display = ('name', 'opacity', 'style')
admin.site.register(Watermark, WatermarkAdmin)
"""
#------------------EXPOMAP VIEWS----------------------------------------------
from django.views.generic import ListView, FormView
@ -301,7 +60,7 @@ class AdminViewObject(FormView):
class PhotoView(AdminViewObject):
model = Photo
form_class = PhotoForm
template_name = 'photogallery/admin_photo.html'
template_name = 'admin/photogallery/admin_photo.html'
success_url = '/admin/photogallery/photo/all/'
def get_form(self, form_class):
@ -315,6 +74,7 @@ class PhotoView(AdminViewObject):
photo = self.obj
data = {}
data['image'] = photo.image.url
data['sort'] = photo.sort
for code, name in settings.LANGUAGES:
obj = Photo._meta.translations_model.objects.get(language_code = code,master__id=getattr(photo, 'id')) #access to translated fields
@ -328,7 +88,7 @@ class PhotoView(AdminViewObject):
class GalleryView(AdminViewObject):
model = Gallery
form_class = GalleryForm
template_name = 'photogallery/admin_gallery.html'
template_name = 'admin/photogallery/admin_gallery.html'
success_url = '/admin/photogallery/gallery/all/'
def get_form(self, form_class):
@ -355,13 +115,13 @@ class GalleryView(AdminViewObject):
class PhotoListView(ListView):
paginate_by = settings.ADMIN_PAGINATION
model = Photo
template_name = 'photogallery/admin_photo_list.html'
template_name = 'admin/photogallery/admin_photo_list.html'
class GalleryListView(ListView):
paginate_by = settings.ADMIN_PAGINATION
model = Gallery
template_name = 'photogallery/admin_gallery_list.html'
template_name = 'admin/photogallery/admin_gallery_list.html'
def delete_photo(request, photo_id):

@ -5,7 +5,7 @@ from client_view import GalleryView, PhotoView
urlpatterns = patterns('',
#url(r'gallery/(?P<slug>.*)$', GalleryView.as_view()),
#url(r'photo/(?P<slug>.*)$', PhotoView.as_view()),
url(r'^show/photo/(?P<id>.*)$', 'photologue.client_view.ajax_photo'),
url(r'^show/photo/(?P<id>.*)/$', 'photologue.client_view.ajax_photo'),
)

@ -18,8 +18,8 @@ class GalleryForm(forms.Form):
# 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['title_%s' % code] = forms.CharField(label='Описание', required=required)
self.fields['description_%s' % code] = forms.CharField(label='Заголовок', required=required)
self.fields['title_%s' % code] = forms.CharField(label='Заголовок', required=required)
self.fields['description_%s' % code] = forms.CharField(label='Описание', required=False)
def save(self, obj=None):
data = self.cleaned_data
@ -35,6 +35,7 @@ class GalleryForm(forms.Form):
class PhotoForm(forms.Form):
image = forms.ImageField(label=u'Изображение', required=False)
sort = forms.IntegerField(label=u'Позиция', initial=10, required=False)
def __init__(self, *args, **kwargs):
"""
@ -60,9 +61,11 @@ class PhotoForm(forms.Form):
else:
photo = obj
photo.image = obj.image
if data.get('sort'):
photo.sort = data['sort']
fill_with_signal(Photo, photo, data)
photo.save()
return photo

@ -15,7 +15,7 @@ except ImportError:
import django
from django.utils.timezone import now
from django.db import models
from django.db.models.signals import post_init, post_save
from django.db.models.signals import post_init, post_save, pre_delete
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
@ -29,6 +29,7 @@ from django.utils.encoding import python_2_unicode_compatible
from django.core.validators import RegexValidator
from django.contrib import messages
from django.contrib.sites.models import Site
from functions.signal_handlers import post_save_handler, file_cleanup
# Required PIL classes may or may not be available from the root namespace
# depending on the installation method used.
@ -693,17 +694,14 @@ class ImageModel(models.Model):
@python_2_unicode_compatible
class Photo(TranslatableModel, ImageModel):
translations = TranslatedFields(
title = models.CharField(_('title'),
max_length=200),
caption = models.TextField(_('caption'),
blank=True)
caption=models.TextField(_('caption'), blank=True),
title=models.CharField(_('title'), max_length=200)
)
slug = models.SlugField(_('slug'),
unique=True,
help_text=_('A "slug" is a unique URL-friendly title for an object.'),
max_length=200)
sort = models.PositiveIntegerField(verbose_name="Sort", null=True, default=10, db_index=True)
date_added = models.DateTimeField(_('date added'),
default=now)
is_public = models.BooleanField(_('is public'),
@ -712,19 +710,18 @@ class Photo(TranslatableModel, ImageModel):
tags = TagField(help_text=tagfield_help_text, verbose_name=_('tags'))
sites = models.ManyToManyField(Site, verbose_name=_(u'sites'),
blank=True, null=True)
users = models.ManyToManyField(UserMark, null=True)
objects = PhotologueManager()
class Meta:
ordering = ['-date_added']
ordering = ['sort']
get_latest_by = 'date_added'
verbose_name = _("photo")
verbose_name_plural = _("photos")
def __str__(self):
return self.get_available_title()
return str(self.id)
def translation_model(self):
return self._meta.translations_model
@ -1107,9 +1104,6 @@ def add_default_site(instance, created, **kwargs):
post_save.connect(add_default_site, sender=Gallery)
post_save.connect(add_default_site, sender=Photo)
from django.db.models.signals import post_save
from functions.signal_handlers import post_save_handler
pre_delete.connect(file_cleanup, sender=Photo)
post_save.connect(post_save_handler, sender=Photo)
post_save.connect(post_save_handler, sender=Gallery)

@ -48,7 +48,7 @@ class PlaceExposition(TranslatableModel, ExpoMixin):
url = models.SlugField(unique=True, max_length=255)
country = models.ForeignKey('country.Country', on_delete=models.PROTECT)
city = models.ForeignKey('city.City', on_delete=models.PROTECT, related_name='place_expositions')
photogallery = models.ForeignKey('photologue.Gallery', null=True, blank=True)
photogallery = models.ForeignKey('photologue.Gallery', null=True, blank=True, on_delete=models.SET_NULL)
#type uses EnumField for creating Enum type field in Mysql database
type = EnumField(values = [item1 for item1, item2 in EXPOSITION_TYPE])
#information

@ -94,9 +94,11 @@ class PlaceDetail(JitterCacheMixin, MetadataMixin, DetailView):
context['country'] = str(obj.country_id)
return context
class PlacePhoto(ListView):
template_name = 'client/place/photo.html'
obj = None
paginate_by = settings.CLIENT_PAGINATION
def get_queryset(self):
slug = self.kwargs.get('slug')
@ -109,7 +111,10 @@ class PlacePhoto(ListView):
raise Http404(_("No %(verbose_name)s found matching the query") %
{'verbose_name': PlaceExposition._meta.verbose_name})
self.obj = place
return place.photogallery.photos.all()
if place.photogallery:
return place.photogallery.photos.all()
else:
raise Http404()
def get_context_data(self, **kwargs):
context = super(PlacePhoto, self).get_context_data(**kwargs)
@ -122,7 +127,7 @@ class PlacePhoto(ListView):
class PlaceList(JitterCacheMixin, MetadataMixin, ListView):
model = PlaceExposition
paginate_by = 10
paginate_by = settings.CLIENT_PAGINATION
template_name = 'client/place/place_list.html'
@ -136,7 +141,7 @@ class PlaceList(JitterCacheMixin, MetadataMixin, ListView):
class PlaceCatalog(JitterCacheMixin, MetadataMixin, ListView):
cache_range = settings.CACHE_RANGE
model = PlaceExposition
paginate_by = 10
paginate_by = settings.CLIENT_PAGINATION
template_name = 'client/place/catalog.html'
filter_object = None

@ -14,6 +14,13 @@
</div>
</div>
<div class="control-group{% if form.sort.errors %}error{% endif %}">
<label class="control-label">{{ form.sort.label }}:</label>
<div class="controls">{{ form.sort }}
<span class="help-inline">{{ form.sort.errors }}</span>
</div>
</div>
{% with field='caption' form=form languages=languages %}
{% include 'admin/forms/multilang.html' %}
{% endwith %}

@ -25,11 +25,10 @@
<h2><i class="icon-pencil"></i> Основная информация</h2>
</div>
<div class="box-content">
{# description #}
{% include 'admin/forms/multilang.html' with field='description' form=form languages=languages %}
{# title #}
{% include 'admin/forms/multilang.html' with field='title' form=form languages=languages %}
{# description #}
{% include 'admin/forms/multilang.html' with field='description' form=form languages=languages %}
</div>
</div>
<div class="box span8">

@ -39,6 +39,14 @@
</div>
{% endif %}
{# sort #}
<div class="control-group {% if form.sort.errors %}error{% endif %}">
<label class="control-label"><b>{{ form.sort.label }}:</b></label>
<div class="controls">
{{ form.sort }}
<span class="help-inline">{{ form.sort.errors }}</span>
</div>
</div>
{# caption #}
{% include 'admin/forms/multilang.html' with field='caption' form=form languages=languages %}
{# title #}

@ -12,6 +12,7 @@
<th>Заголовок</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
@ -19,20 +20,13 @@
<tr>
<td>{{ item.title }}</td>
<td>
<img src="{{ item.get_admin_thumbnail_url }}" class="thumbnail" alt="{{ item.title }}">
</td>
<td class="center sorting_1">
<a class="btn-small btn-info" href="{{ item.admin_url }}">
Изменить
</a>
</td>
<td class="center sorting_1">
<a class="btn-small btn-inverse" href="#">
Копировать
</a>
</td>
<td>
<a class="btn-small btn-danger delete" href="#">

@ -0,0 +1,26 @@
{% extends 'base_catalog.html' %}
{% load i18n %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
<a href="/">{% trans 'Главная страница' %}</a>
<a href="{{ object.catalog }}">{% trans 'Конференции' %}</a>
<a href="{{ object.catalog }}country/{{ object.country.url }}/">{{ object.country }}</a>
<a href="{{ object.catalog }}city/{{ object.city.url }}/">{{ object.city }}</a>
<a href="{{ object.get_permanent_url }}">{{ object.name }}</a>
<strong>{% trans 'Фото' %}</strong>
</div>
{% endblock %}
{% block page_title %}
{% endblock %}
{% block content_list %}
{% include 'client/includes/conference/photo.html' with object=object %}
{% endblock %}
{% block paginator %}
{% include 'client/includes/catalog_paginator.html' with page_obj=page_obj %}
{% endblock %}

@ -1,219 +0,0 @@
{% extends 'base_catalog.html' %}
{% load static %}
{% load i18n %}
{% load template_filters %}
{% block content_list %}
{% block content_text %}
{% block page_body %}
<div class="m-article">
<div class="item-wrap event clearfix">
<aside>
{% if object_list.0.expohit %}
<div class="hit"></div>
{% endif %}
<div class="i-pict">
{% with obj=object_list.0 %}
{% include 'client/includes/show_logo.html' %}
{% endwith %}
</div>
<!--
<div class="i-rating" title="Рейтинг: 551">551</div>
-->
<div class="i-stats">
{% if object_list.0.visitors %}
<span class="visitors" title="Посетители">{{ object_list.0.visitors }}</span>
{% endif %}
{% if object_list.0.members %}
<span class="participants" title="Участники">{{ object_list.0.members }}</span>
{% endif %}
</div>
<div class="i-discount">
{% if object_list.0.discount %}
<a class="discount-button" href="#">{% trans 'Скидка' %} -{{ object_list.0.discount }}%</a>
<div class="dsc-text">{{ object_list.0.discount_description|safe }}</div>
{% endif %}
</div>
</aside>
<div class="i-info">
<header>
<div class="i-title">
{% if object_list.0.main_title %}
{{ object_list.0.main_title|safe }}
{% else %}
{{ object_list.0.name|safe }}
{% endif %}
</div>
</header>
<div class="i-date">
{% with obj=object_list.0 %}
{% include 'client/includes/show_date_block.html' %}
{% endwith %}
</div>
{% if object_list.0.place %}
<div class="i-address">
<header>
<div class="address">
{{ object_list.0.place.address.address }}
</div>
<div class="show-map"><a class="toggle-map" href="#">{% trans 'Раскрыть карту' %}</a></div>
</header>
<div class="i-map">
<div class="close-map"><a class="toggle-map" href="#">{% trans 'Скрыть карту' %}</a>
</div>
<div class="map-canvas" id="map-canvas"
data-coords="{{ object_list.0.place.address.lat }},{{ exposition.place.address.lng }}"></div>
</div>
</div>
{% endif %}
</div>
</div>
<div class="e-price">
<div class="sect-title">{% trans 'Стоимость посещения и участия' %}</div>
<div class="ep-wrap">
<div class="e-price-wrap">
<div class="epr-layout">
<div class="eprl-col">
<div class="epr-title"><span>{% trans 'Для посещения' %}</span></div>
<div class="epr-subtitle">{% trans 'Стоимость билетов' %}</div>
<div class="tp-wrap">
<ul class="pr-list">
{% if object_list.0.price_day %}
<li>
<div class="prl-value">{{ object_list.0.price_day }} €</div>
<div class="prl-descr"><span>{% trans 'на 1 день' %}</span></div>
</li>
{% endif %}
{% if object_list.0.price_all %}
<li>
<div class="prl-value">{{ object_list.0.price_all }} €</div>
<div class="prl-descr"><span>{% trans 'на все дни' %}</span></div>
</li>
{% endif %}
</ul>
<div class="tp-descr">{% trans 'Предварительная регистрация' %}</div>
</div>
<div class="tp-wrap">
<ul class="pr-list gray">
{% if object_list.0.price_day_bar %}
<li>
<div class="prl-value">{{ object_list.0.price_day_bar }} €</div>
<div class="prl-descr"><span>на 1 день</span></div>
</li>
{% endif %}
{% if object_list.0.price_all_bar %}
<li>
<div class="prl-value">{{ object_list.0.price_all_bar }} €</div>
<div class="prl-descr"><span>{% trans 'на все дни' %}</span></div>
</li>
{% endif %}
</ul>
<div class="tp-descr gray">{% trans 'Регистрация на' %}&nbsp;{% trans 'стойке' %}</div>
</div>
<div class="tp-btn-wrap">
<div class="tp-btn">
<a class="button big orange b-more" href="#">{% trans 'Заказать билет' %}</a>
</div>
<div class="tp-categories">
<div class="tpc-title">{% trans 'Выставка открыта для' %}:</div>
<ul>
{{ object_list.0.get_audience }}
</ul>
</div>
</div>
</div>
<div class="eprl-col">
<div class="epr-title"><span>{% trans 'Для участия' %}</span></div>
<div class="epr-subtitle">{% trans 'Стоимость аренды 1м²' %}</div>
<ul class="pr-list">
{% if object_list.0.max_closed_equipped_area %}
<li>
<div class="prl-value">{{ object_list.0.max_closed_equipped_area }} €</div>
<div class="prl-descr"><span>{% trans 'оборудованная площадь' %}</span></div>
</li>
{% endif %}
{% if object_list.0.max_closed_area %}
<li>
<div class="prl-value">{{ object_list.0.max_closed_area }} €</div>
<div class="prl-descr"><span>{% trans 'необорудованная площадь' %}</span></div>
</li>
{% endif %}
{% if object_list.0.max_open_area %}
<li>
<div class="prl-value">{{ object_list.0.max_open_area }} €</div>
<div class="prl-descr"><span>{% trans 'открытая площадь' %}</span></div>
</li>
{% endif %}
</ul>
<a class="button big orange b-more" href="#">{% trans 'Заявка на участие' %}</a>
<div class="epr-conditons">
{% if object_list.0.min_stand_size %}
<p>{% trans 'Минимальный размер стенда' %} — {{ object_list.0.min_stand_size }}м²</p>
{% endif %}
{% if object_list.0.registration_payment %}
<p>{% trans 'Регистрационный взнос' %} — {{ object_list.0.registration_payment }}€</p>
{% endif %}
{% if object_list.0.application_deadline %}
<p>{% trans 'Крайний срок подачи заявки' %} — {{ object_list.0.application_deadline }}</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ed-back">
<a href="/{{ filter|generate_url:'event' }}">{{ object_list.0.name|safe }}</a>
</div>
<div class="i-sub-articles">
<ul>
{% for service in object_list.0.get_services %}
<li><a href="#">{{ service.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}
{% endblock %}
{% endblock %}

@ -1,134 +0,0 @@
{% extends 'base_catalog.html' %}
{% load static %}
{% load i18n %}
{% load pytils_dt %}
{% load template_filters %}
{% block content_list %}
{% block content_text %}
{% block page_body %}
<div class="m-article">
<div class="item-wrap event clearfix">
<aside>
{% if object_list.0.expohit %}
<div class="hit"></div>
{% endif %}
<div class="i-pict">
{% with obj=object_list.0 %}
{% include 'client/includes/show_logo.html' %}
{% endwith %}
</div>
<!--
<div class="i-rating" title="Рейтинг: 551">551</div>
-->
<div class="i-stats">
{% if object_list.0.visitors %}
<span class="visitors" title="Посетители">{{ object_list.0.visitors }}</span>
{% endif %}
{% if object_list.0.members %}
<span class="participants" title="Участники">{{ object_list.0.members }}</span>
{% endif %}
</div>
<div class="i-discount">
{% if object_list.0.discount %}
<a class="discount-button" href="#">{% trans 'Скидка' %} -{{ object_list.0.discount }}%</a>
<div class="dsc-text">{{ object_list.0.discount_description|safe }}</div>
{% endif %}
</div>
</aside>
<div class="i-info">
<header>
<div class="i-title">
{{ object_list.0.main_title|safe }}
</div>
</header>
<div class="i-date">
{% with obj=object_list.0 %}
{% include 'client/includes/show_date_block.html' %}
{% endwith %}
</div>
{% if object_list.0.place %}
<div class="i-address">
<header>
<div class="address">
{{ object_list.0.place.address.address }}
</div>
<div class="show-map"><a class="toggle-map" href="#">{% trans 'Раскрыть карту' %}</a></div>
</header>
<div class="i-map">
<div class="close-map"><a class="toggle-map" href="#">{% trans 'Скрыть карту' %}</a>
</div>
<div class="map-canvas" id="map-canvas" data-coords="{{ object_list.0.place.address.lat }},{{ exposition.place.address.lng }}" ></div>
</div>
</div>
{% endif %}
</div>
</div>
<hr/>
<div class="e-programm">
<div class="sect-title">Деловая программа</div>
<div class="ep-wrap">
{% for day in object_list.0.get_timetables_days %}
<div class="ep-sect {% if forloop.counter == 1 %}eps-opened{% endif %}">
<div class="ep-sect-title">
<a class="eps-open" href="#">
{% ifequal LANGUAGE_CODE 'ru' %}
{{ day|ru_strftime_preposition:"%d %B" }}
{% else %}
{{ day|date:"j F" }}
{% endifequal %}
</a>
</div>
<div class="ep-sect-body">
<ul>
{% for pr in object_list.0.business_program.all|timetable_by_day:day %}
<li>
<div class="ep-item">
<header class="clearfix">
<div class="ep-time">{{ pr.begin|date:"G:i" }} – {{ pr.end|date:"G:i" }}</div>
<div class="ep-title"><span>{{ pr.name }}</span></div>
</header>
<div class="ep-body">
{{ pr.programe|safe }}<span class="ep-coord">{% trans 'Организатор' %}: {{ pr.speaker }}</span>
</div>
<footer class="clearfix">
<div class="ap-area">{{ pr.place }}</div>
</footer>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endfor %}
</div>
</div>
{% with event=exposition filter=filter %}
{% include 'includes/event_steps.html' %}
{% endwith %}
</div>
<div class="ed-back">
<a href="/{{ filter|generate_url:'event' }}">{{ object_list.0 }}</a>
</div>
<div class="i-sub-articles">
<ul>
{% for service in object_list.0.get_services %}
<li><a href="{% if filter %}/{{ filter|generate_url:'event' }}/service/{{ service.url }}/{% else %}{{ event.get_permanent_url }}/service/{{ service.url }}/{%endif%}">
{{ service.name }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
{% endblock %}
{% endblock %}

@ -1,170 +0,0 @@
{% extends 'base_catalog.html' %}
{% load static %}
{% load i18n %}
{% load template_filters %}
{% block content_list %}
{% block content_text %}
{% block page_body %}
<div class="m-article">
<div class="item-wrap event clearfix">
<aside>
{% if object_list.0.expohit %}
<div class="hit"></div>
{% endif %}
<div class="i-pict">
{% with obj=object_list.0 %}
{% include 'client/includes/show_logo.html' %}
{% endwith %}
</div>
<!--
<div class="i-rating" title="Рейтинг: 551">551</div>
-->
<div class="i-stats">
{% if object_list.0.visitors %}
<span class="visitors" title="Посетители">{{ object_list.0.visitors }}</span>
{% endif %}
{% if object_list.0.members %}
<span class="participants" title="Участники">{{ object_list.0.members }}</span>
{% endif %}
</div>
<div class="i-discount">
{% if object_list.0.discount %}
<a class="discount-button" href="#">{% trans 'Скидка' %} -{{ object_list.0.discount }}%</a>
<div class="dsc-text">{{ object_list.0.discount_description|safe }}</div>
{% endif %}
</div>
</aside>
<div class="i-info">
<header>
<div class="i-title">
{% if object_list.0.main_title %}
{{ object_list.0.main_title|safe }}
{% else %}
{{ object_list.0.name|safe }}
{% endif %}
</div>
</header>
<div class="i-date">
{% with obj=object_list.0 %}
{% include 'client/includes/show_date_block.html' %}
{% endwith %}
</div>
{% if object_list.0.place %}
<div class="i-address">
<header>
<div class="address">
{{ object_list.0.place.address.address }}
</div>
<div class="show-map"><a class="toggle-map" href="#">{% trans 'Раскрыть карту' %}</a></div>
</header>
<div class="i-map">
<div class="close-map"><a class="toggle-map" href="#">{% trans 'Скрыть карту' %}</a>
</div>
<div class="map-canvas" id="map-canvas" data-coords="{{ object_list.0.place.address.lat }},{{ exposition.place.address.lng }}" ></div>
</div>
</div>
{% endif %}
</div>
</div>
<hr />
<div class="e-statistic">
<div class="sect-title">{% trans 'Статистика' %}</div>
<div class="ep-wrap">
{% for st in object_list.0.statistic.all %}
<div class="ep-sect">
<div class="ep-sect-title"><a class="eps-open" href="#">{{ st.year }}</a></div>
<div class="ep-sect-body">
<div class="ep-stats clearfix">
<div class="eps-item ">
<b>{{ st.visitors }}</b>
<div class="eps-text">{% trans 'посетителей' %}</div>
</div>
<div class="eps-item">
<b>{{ st.members }}</b>
<div class="eps-text">{% trans 'учасников' %}</div>
</div>
</div>
<div class="ep-info clearfix">
{% if object_list.0.place %}
<div class="ep-area-wrap">
<div class="epa-title">{% trans 'Общая выставочная площадь' %}</div>
<div class="epa-area">{{ object_list.0.place.total_area }} {% trans 'м' %}<sup>2</sup></div>
</div>
{% endif %}
<div class="ep-founded"><b>{{ object_list.0.foundation_year }}</b> год основания</div>
</div>
<div class="ep-countries clearfix">
<div class="epc-title">{% trans 'Страны' %}</div>
<div class="epc-list">
<ul>
<li>Австралия</li>
<li>Австрия</li>
<li>Азербайджан</li>
<li>Албания</li>
<li>Алжир</li>
<li>Ангола</li>
</ul>
<ul>
<li>Андорра</li>
<li>Антигуа</li>
<li>Аргентина</li>
<li>Армения</li>
<li>Афганистан</li>
<li>Багамские острова</li>
</ul>
<ul>
<li>Бангладеш</li>
<li>Барбадос</li>
<li>Бахрейн</li>
<li>Белиз</li>
</ul>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% with event=object_list.0 %}
{% include 'includes/event_steps.html' %}
{% endwith %}
</div>
<div class="ed-back">
<a href="/{{ filter|generate_url:'event' }}">{{ object_list.0.name|safe }}</a>
</div>
<div class="i-sub-articles">
<ul>
{% for service in object_list.0.get_services %}
<li><a href="#">{{ service.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}
{% endblock %}
{% endblock %}

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<ul>
{% for exposition in object_list %}
<li>{{ exposition.name }}</li>
{% endfor %}
</ul>
{{ filter }}
</body>
</html>

@ -0,0 +1,26 @@
{% extends 'base_catalog.html' %}
{% load i18n %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
<a href="/">{% trans 'Главная страница' %}</a>
<a href="{{ object.catalog }}">{% trans 'Выставки' %}</a>
<a href="{{ object.catalog }}country/{{ object.country.url }}/">{{ object.country }}</a>
<a href="{{ object.catalog }}city/{{ object.city.url }}/">{{ object.city }}</a>
<a href="{{ object.get_permanent_url }}">{{ object.name }}</a>
<strong>{% trans 'Фото' %}</strong>
</div>
{% endblock %}
{% block page_title %}
{% endblock %}
{% block content_list %}
{% include 'client/includes/exposition/photo.html' with object=object %}
{% endblock %}
{% block paginator %}
{% include 'client/includes/catalog_paginator.html' with page_obj=page_obj %}
{% endblock %}

@ -19,6 +19,35 @@
{% block content_list %}
{% include 'client/includes/exposition/programm.html' with exposition=object %}
<script>
$('a.eps-open').on('click', function () {
var $switch = $(this);
var $sect = $switch.closest('.ep-sect');
var $sectBody = $sect.children('div.ep-sect-body');
if ($sect.hasClass('eps-opened')) {
$sectBody
.stop()
.animate({
height: 'hide',
opacity: 'hide'
}, 300, function () {
$sect.removeClass('eps-opened');
});
} else {
$sectBody
.stop()
.animate({
height: 'show',
opacity: 'show'
}, 300, function () {
$sect.addClass('eps-opened');
});
}
return false;
});
</script>
{% endblock %}
{% block paginator %}

@ -90,6 +90,9 @@
{% if request.user.is_admin %}
<a class="button green " href="/admin/conference/{{ object.url }}/">{% trans 'изменить' %}</a>
{% endif %}
{% if event.photogallery %}
<a class="button blue icon-photo" href="{{ event.get_permanent_url }}photo/">{% trans 'фото' %}</a>
{% endif %}
</div>
<div class="ib-add"><a target="_blank" class="button blue2 icon-find" href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ object.city.id }}">{% trans 'Найти отель' %}</a></div>
</div>

@ -0,0 +1,79 @@
{% load static %}
{% load i18n %}
{% load template_filters %}
{% block page_body %}
<div class="m-article cl-photos">
<div class="cl-item">
<div class="cl-item-wrap clearfix">
<div class="cli-pict">
<a href="{{ object.get_permanent_url }}">
{% with obj=object %}
{% include 'client/includes/show_logo.html' %}
{% endwith %}
</a>
</div>
<div class="cli-info">
<div class="cli-top clearfix">
<header>
<div class="cli-title">
<a href="{{ object.get_permanent_url }}">{{ object.name|safe }}</a>
</div>
</header>
{% if object.main_title %}
<div class="cli-descr">
{{ object.main_title|safe }}
</div>
{% endif %}
</div>
<div class="cli-bot clearfix">
<div class="cli-place">
<a href="{{ object.catalog }}{{ object.country.url }}/">{{ object.country.name }}</a>, <a href="{{ object.catalog }}{{ object.city.url }}/">{{ object.city.name }}</a>
</div>
</div>
</div>
</div>
</div>
<div id="cli-pg" class="cli-photo-gallery">
<ul class="clearfix">
{% with object_list=object_list %}
{% for photo in object_list %}
<li>
<a class="open-photo" href="#" >
<img src="{{ photo.get_client_thumbnail_url }}" data-image-id="{{ photo.id }}"/>
<span class="pg-title">{{ photo.caption }}</span>
</a>
</li>
{% endfor %}
{% endwith %}
</ul>
</div>
</div>
{% endblock %}
{% block photogallery %}
{% include 'client/popups/photo.html' %}
{% endblock %}
{% block scripts %}
<script src="{% static 'client/js_min/_modules/page.place.photo.min.js' %}"></script>
<script>
//js module initialization
EXPO.placePhoto.init({
ajaxUrl:'/gallery/show/photo/',
galleryContainerId:'cli-pg',
nextButtonId:'pgpc-next',
prevButtonId:'pgpc-prev',
closeModalButtonId:'pg-close',
modalId:'pw-gallery',
modalContainerId:'popup-gallery-id',
modalTrigger:'open-photo'
});
</script>
{% endblock %}

@ -89,6 +89,10 @@
{% if request.user.is_admin %}
<a class="button green " href="/admin/exposition/{{ object.url }}/">{% trans 'изменить' %}</a>
{% endif %}
{% if exposition.photogallery %}
<a class="button blue icon-photo" href="{{ exposition.get_permanent_url }}photo/">{% trans 'фото' %}</a>
{% endif %}
</div>
<div class="ib-add"><a class="button blue2 icon-find" href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ object.city.id }}">{% trans 'Найти отель' %}</a></div>
</div>

@ -94,6 +94,10 @@
{% if request.user.is_admin %}
<a target="_blank" class="button green " href="/admin/exposition/{{ object.url }}/">{% trans 'изменить' %}</a>
{% endif %}
{% if exposition.photogallery %}
<a class="button blue icon-photo" href="{{ exposition.get_permanent_url }}photo/">{% trans 'фото' %}</a>
{% endif %}
</div>
<div class="ib-add"><a target="_blank" class="button blue2 icon-find" href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ object.city.id }}">{% trans 'Найти отель' %}</a></div>
</div>

@ -0,0 +1,79 @@
{% load static %}
{% load i18n %}
{% load template_filters %}
{% block page_body %}
<div class="m-article cl-photos">
<div class="cl-item">
<div class="cl-item-wrap clearfix">
<div class="cli-pict">
<a href="{{ object.get_permanent_url }}">
{% with obj=object %}
{% include 'client/includes/show_logo.html' %}
{% endwith %}
</a>
</div>
<div class="cli-info">
<div class="cli-top clearfix">
<header>
<div class="cli-title">
<a href="{{ object.get_permanent_url }}">{{ object.name|safe }}</a>
</div>
</header>
{% if object.main_title %}
<div class="cli-descr">
{{ object.main_title|safe }}
</div>
{% endif %}
</div>
<div class="cli-bot clearfix">
<div class="cli-place">
<a href="{{ object.catalog }}{{ object.country.url }}/">{{ object.country.name }}</a>, <a href="{{ object.catalog }}{{ object.city.url }}/">{{ object.city.name }}</a>
</div>
</div>
</div>
</div>
</div>
<div id="cli-pg" class="cli-photo-gallery">
<ul class="clearfix">
{% with object_list=object_list %}
{% for photo in object_list %}
<li>
<a class="open-photo" href="#" >
<img src="{{ photo.get_client_thumbnail_url }}" data-image-id="{{ photo.id }}"/>
<span class="pg-title">{{ photo.caption }}</span>
</a>
</li>
{% endfor %}
{% endwith %}
</ul>
</div>
</div>
{% endblock %}
{% block photogallery %}
{% include 'client/popups/photo.html' %}
{% endblock %}
{% block scripts %}
<script src="{% static 'client/js_min/_modules/page.place.photo.min.js' %}"></script>
<script>
//js module initialization
EXPO.placePhoto.init({
ajaxUrl:'/gallery/show/photo/',
galleryContainerId:'cli-pg',
nextButtonId:'pgpc-next',
prevButtonId:'pgpc-prev',
closeModalButtonId:'pg-close',
modalId:'pw-gallery',
modalContainerId:'popup-gallery-id',
modalTrigger:'open-photo'
});
</script>
{% endblock %}

@ -118,7 +118,7 @@
{% endif %}
{% endwith %}
{% with event=exposition filter=filter %}
{% include 'includes/event_steps.html' %}
{% include 'client/includes/event_steps.html' %}
{% endwith %}

@ -15,9 +15,7 @@
{% include 'client/includes/show_logo.html' %}
{% endwith %}
</div>
<!--
<div class="i-rating" title="Рейтинг: 551">551</div>
-->
<div class="i-stats">
{% if exposition.visitors %}
<span class="visitors" title="Посетители">{{ exposition.visitors }}</span>

@ -1,47 +0,0 @@
{% load i18n %}
{% load template_filters %}
{% if page_obj.paginator.num_pages > 1 %}
<div class="pagination clearfix">
<div class="pg-info"> Показано {{ page_obj.start_index }} - {{ page_obj.end_index }} <i>(всего {{ page_obj.paginator.count }} позиций)</i></div>
<div class="pg-body">
{% if page_obj.has_previous %}
<a class="pg-prev" href="/{{ filter|generate_url }}/{{ page_obj.previous_page_number }}">Предыдущая</a>
{% else %}
<a class="pg-prev disabled" href="#">Предыдущая</a>
{% endif %}
<ul>
{% if page_obj.number > 2 %}
<li><a href="/{{ filter|generate_url }}/{{ 1 }} ">{{ 1 }}</a></li>
{% if page_obj.number > 3 %}
<li>...</li>
{% endif %}
{% endif %}
{% if page_obj.has_previous %}
<li><a href="/{{ filter|generate_url }}/{{ page_obj.previous_page_number }} ">{{ page_obj.previous_page_number }}</a></li>
{% endif %}
<li><b>{{ page_obj.number }}</b></li>
{% if page_obj.has_next %}
<li><a href="/{{ filter|generate_url }}/{{ page_obj.next_page_number }} ">{{ page_obj.next_page_number }}</a></li>
{% endif %}
{% if page_obj.paginator.num_pages|subtract:page_obj.number > 1 %}
{% if page_obj.paginator.num_pages|subtract:page_obj.number > 2 %}
<li>...</li>
{% endif %}
<li><a href="/{{ filter|generate_url }}/{{ page_obj.paginator.num_pages }} ">{{ page_obj.paginator.num_pages }}</a></li>
{% endif %}
</ul>
{% if page_obj.has_next %}
<a class="pg-next" href="/{{ filter|generate_url }}/{{ page_obj.next_page_number }}">Следующая</a>
{% else %}
<a class="pg-next disabled" href="#">Следующая</a>
{% endif %}
</div>
</div>
{% endif %}

@ -4,7 +4,7 @@
{% block page_body %}
<div class="m-article cl-photos">
<div class="m-article cl-photos">
<div class="cl-item">
<div class="cl-item-wrap clearfix">
<div class="cli-pict">
@ -28,7 +28,7 @@
<div class="cli-bot clearfix">
{% if object.country %}
<div class="cli-place">
<a href="#">{{ object.country }}</a>, <a href="#">{{ object.city }}</a>
<a href="/places/{{ object.country.url }}/">{{ object.country }}</a>, <a href="/places/{{ object.city.url }}/">{{ object.city }}</a>
</div>
{% endif %}
</div>
@ -47,7 +47,7 @@
<li>
<a class="open-photo" href="#" >
<img src="{{ photo.get_client_thumbnail_url }}" data-image-id="{{ photo.id }}"/>
<span class="pg-title">{{ photo.title }}</span>
<span class="pg-title">{{ photo.caption }}</span>
</a>
</li>
{% endfor %}
@ -56,24 +56,19 @@
</ul>
</div>
</div>
{% block paginator %}
{% with page_obj=page_obj queries=queries %}
{% include 'includes/paginator.html' %}
{% endwith %}
{% endblock %}
{% endblock %}
{% block photogallery %}
{% include 'client/popups/photo.html' %}
{% endblock %}
{% block scripts %}
<script src="{% static 'client/js/pages/place_photo.js' %}"></script>
<script src="{% static 'client/js_min/_modules/page.place.photo.min.js' %}"></script>
<script>
//js module initialization
EXPO.placePhoto.init({
ajaxUrl:'http://hit.expomap.ru/gallery/show/photo/',
ajaxUrl:'/gallery/show/photo/',
galleryContainerId:'cli-pg',
nextButtonId:'pgpc-next',
prevButtonId:'pgpc-prev',

Loading…
Cancel
Save