From e38616cc03a14b7b2c4ad2e4abc17784ad509150 Mon Sep 17 00:00:00 2001 From: Nazar Kotjuk Date: Tue, 27 Oct 2015 18:03:45 +0200 Subject: [PATCH] Photogallery fix --- conference/admin.py | 2 +- conference/models.py | 24 +- conference/urls.py | 4 +- conference/views.py | 26 +- exposition/admin.py | 29 +- exposition/models.py | 45 +--- exposition/urls.py | 8 +- exposition/views.py | 24 ++ functions/model_mixin.py | 33 +++ functions/signal_handlers.py | 22 +- import_xls/models.py | 12 +- photologue/admin.py | 250 +----------------- photologue/client_urls.py | 2 +- photologue/forms.py | 9 +- photologue/models.py | 22 +- place_exposition/models.py | 2 +- place_exposition/views.py | 11 +- templates/admin/includes/photo_form.html | 7 + .../admin/photogallery/admin_gallery.html | 5 +- templates/admin/photogallery/admin_photo.html | 8 + .../admin/photogallery/admin_photo_list.html | 10 +- templates/client/conference/photo.html | 26 ++ .../client/exposition/exposition_price.html | 219 --------------- .../exposition/exposition_programm.html | 134 ---------- .../exposition/exposition_statistic.html | 170 ------------ .../expositiontranslation_list.html | 17 -- templates/client/exposition/photo.html | 26 ++ templates/client/exposition/programm.html | 29 ++ .../conference/conference_object.html | 3 + .../client/includes/conference/photo.html | 79 ++++++ .../client/includes/exposition/expo_paid.html | 4 + .../exposition/exposition_object.html | 4 + .../client/includes/exposition/photo.html | 79 ++++++ .../client/includes/exposition/programm.html | 2 +- .../client/includes/exposition/statistic.html | 4 +- templates/client/includes/paginator.html | 47 ---- templates/client/includes/place/photo.html | 17 +- 37 files changed, 417 insertions(+), 998 deletions(-) create mode 100644 templates/client/conference/photo.html delete mode 100644 templates/client/exposition/exposition_price.html delete mode 100644 templates/client/exposition/exposition_programm.html delete mode 100644 templates/client/exposition/exposition_statistic.html delete mode 100644 templates/client/exposition/expositiontranslation_list.html create mode 100644 templates/client/exposition/photo.html create mode 100644 templates/client/includes/conference/photo.html create mode 100644 templates/client/includes/exposition/photo.html delete mode 100644 templates/client/includes/paginator.html diff --git a/conference/admin.py b/conference/admin.py index 7e22fc61..01a24f89 100644 --- a/conference/admin.py +++ b/conference/admin.py @@ -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) diff --git a/conference/models.py b/conference/models.py index 9e2b545e..02d25008 100644 --- a/conference/models.py +++ b/conference/models.py @@ -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): diff --git a/conference/urls.py b/conference/urls.py index 77279394..9e24ad9a 100644 --- a/conference/urls.py +++ b/conference/urls.py @@ -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.*)/(?P\d+)/$', ConferenceTagCatalog.as_view(), {'meta_id':33}), url(r'conference/tag/(?P.*)/$', ConferenceTagCatalog.as_view(), {'meta_id':32}), # conf additional pages + url(r'^conference/(?P.*)/photo/page/(?P\d+)/$', ConferencePhotoView.as_view()), + url(r'^conference/(?P.*)/photo/$', ConferencePhotoView.as_view()), url(r'conference/(?P.*)/visitors/page/(?P\d+)/$', ConferenceVisitors.as_view()), url(r'conference/(?P.*)/visitors/$', ConferenceVisitors.as_view()), url(r'conference/(?P.*)/members/page/(?P\d+)/$', ConferenceMembers.as_view()), diff --git a/conference/views.py b/conference/views.py index c5a854e8..abcbd2ce 100644 --- a/conference/views.py +++ b/conference/views.py @@ -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 diff --git a/exposition/admin.py b/exposition/admin.py index f6e751ed..19b3d7f2 100644 --- a/exposition/admin.py +++ b/exposition/admin.py @@ -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) diff --git a/exposition/models.py b/exposition/models.py index b2c55878..2b98d837 100644 --- a/exposition/models.py +++ b/exposition/models.py @@ -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) diff --git a/exposition/urls.py b/exposition/urls.py index 5290ea71..e61f77d4 100644 --- a/exposition/urls.py +++ b/exposition/urls.py @@ -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.*)/program/$', ExpositionProgramme.as_view(), {'meta_id':62}), url(r'^expo/(?P.*)/visitors/page/(?P\d+)/$', ExpoVisitors.as_view(), {'meta_id':64}), url(r'^expo/(?P.*)/visitors/$', ExpoVisitors.as_view(), {'meta_id':64}), + url(r'^expo/(?P.*)/photo/page/(?P\d+)/$', ExpoPhotoView.as_view()), + url(r'^expo/(?P.*)/photo/$', ExpoPhotoView.as_view()), url(r'^expo/(?P.*)/members/page/(?P\d+)/$', ExpoMembers.as_view(), {'meta_id':63}), url(r'^expo/(?P.*)/members/$', ExpoMembers.as_view(), {'meta_id':63}), url(r'^expo/(?P.*)/service/thanks/', ExpositionThankView.as_view()), diff --git a/exposition/views.py b/exposition/views.py index b35e42a6..965d6147 100644 --- a/exposition/views.py +++ b/exposition/views.py @@ -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} diff --git a/functions/model_mixin.py b/functions/model_mixin.py index 30b0a6de..a918c972 100644 --- a/functions/model_mixin.py +++ b/functions/model_mixin.py @@ -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 diff --git a/functions/signal_handlers.py b/functions/signal_handlers.py index a0c3a07a..6c170a1e 100644 --- a/functions/signal_handlers.py +++ b/functions/signal_handlers.py @@ -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() -''' \ No newline at end of file + for field_name, _ in instance.__dict__.iteritems(): + field = getattr(instance, field_name) + if issubclass(field.__class__, FieldFile) and field.name: + field.delete(save=False) \ No newline at end of file diff --git a/import_xls/models.py b/import_xls/models.py index 8bb0d818..f9980f28 100644 --- a/import_xls/models.py +++ b/import_xls/models.py @@ -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): """ diff --git a/photologue/admin.py b/photologue/admin.py index 4686e1bf..53481d2b 100644 --- a/photologue/admin.py +++ b/photologue/admin.py @@ -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): diff --git a/photologue/client_urls.py b/photologue/client_urls.py index e8b48b22..eed40034 100644 --- a/photologue/client_urls.py +++ b/photologue/client_urls.py @@ -5,7 +5,7 @@ from client_view import GalleryView, PhotoView urlpatterns = patterns('', #url(r'gallery/(?P.*)$', GalleryView.as_view()), #url(r'photo/(?P.*)$', PhotoView.as_view()), - url(r'^show/photo/(?P.*)$', 'photologue.client_view.ajax_photo'), + url(r'^show/photo/(?P.*)/$', 'photologue.client_view.ajax_photo'), ) diff --git a/photologue/forms.py b/photologue/forms.py index 788b94a8..79bf4e7b 100644 --- a/photologue/forms.py +++ b/photologue/forms.py @@ -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 diff --git a/photologue/models.py b/photologue/models.py index 781cf48a..fc3e46d3 100644 --- a/photologue/models.py +++ b/photologue/models.py @@ -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) \ No newline at end of file diff --git a/place_exposition/models.py b/place_exposition/models.py index 0db008e7..f4fa2c47 100644 --- a/place_exposition/models.py +++ b/place_exposition/models.py @@ -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 diff --git a/place_exposition/views.py b/place_exposition/views.py index 16115ccd..66732911 100644 --- a/place_exposition/views.py +++ b/place_exposition/views.py @@ -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 diff --git a/templates/admin/includes/photo_form.html b/templates/admin/includes/photo_form.html index 92aa80c6..0244da32 100644 --- a/templates/admin/includes/photo_form.html +++ b/templates/admin/includes/photo_form.html @@ -14,6 +14,13 @@ +
+ +
{{ form.sort }} + {{ form.sort.errors }} +
+
+ {% with field='caption' form=form languages=languages %} {% include 'admin/forms/multilang.html' %} {% endwith %} diff --git a/templates/admin/photogallery/admin_gallery.html b/templates/admin/photogallery/admin_gallery.html index 4230176b..2f09274d 100644 --- a/templates/admin/photogallery/admin_gallery.html +++ b/templates/admin/photogallery/admin_gallery.html @@ -25,11 +25,10 @@

Основная информация

- {# 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 %}
diff --git a/templates/admin/photogallery/admin_photo.html b/templates/admin/photogallery/admin_photo.html index ded4b4e8..be7a3eaa 100644 --- a/templates/admin/photogallery/admin_photo.html +++ b/templates/admin/photogallery/admin_photo.html @@ -39,6 +39,14 @@
{% endif %} + {# sort #} +
+ +
+ {{ form.sort }} + {{ form.sort.errors }} +
+
{# caption #} {% include 'admin/forms/multilang.html' with field='caption' form=form languages=languages %} {# title #} diff --git a/templates/admin/photogallery/admin_photo_list.html b/templates/admin/photogallery/admin_photo_list.html index 6cfc93c7..c5723ca6 100644 --- a/templates/admin/photogallery/admin_photo_list.html +++ b/templates/admin/photogallery/admin_photo_list.html @@ -12,6 +12,7 @@ Заголовок     + @@ -19,20 +20,13 @@ {{ item.title }} - - {{ item.title }} - + Изменить - - - Копировать - - diff --git a/templates/client/conference/photo.html b/templates/client/conference/photo.html new file mode 100644 index 00000000..f232b49a --- /dev/null +++ b/templates/client/conference/photo.html @@ -0,0 +1,26 @@ +{% extends 'base_catalog.html' %} +{% load i18n %} + +{% block bread_scrumbs %} + +{% 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 %} \ No newline at end of file diff --git a/templates/client/exposition/exposition_price.html b/templates/client/exposition/exposition_price.html deleted file mode 100644 index 6e341365..00000000 --- a/templates/client/exposition/exposition_price.html +++ /dev/null @@ -1,219 +0,0 @@ -{% extends 'base_catalog.html' %} -{% load static %} -{% load i18n %} -{% load template_filters %} - - -{% block content_list %} - -{% block content_text %} -{% block page_body %} -
-
- - -
-
-
- {% if object_list.0.main_title %} - {{ object_list.0.main_title|safe }} - {% else %} - {{ object_list.0.name|safe }} - {% endif %} -
-
- -
- {% with obj=object_list.0 %} - {% include 'client/includes/show_date_block.html' %} - {% endwith %} -
- {% if object_list.0.place %} -
-
-
- {{ object_list.0.place.address.address }} -
- -
- - -
- {% endif %} - - -
-
-
-
{% trans 'Стоимость посещения и участия' %}
-
- -
-
- -
-
{% trans 'Для посещения' %}
- -
{% trans 'Стоимость билетов' %}
- -
- -
    - {% if object_list.0.price_day %} -
  • -
    {{ object_list.0.price_day }} €
    -
    {% trans 'на 1 день' %}
    -
  • - {% endif %} - {% if object_list.0.price_all %} -
  • -
    {{ object_list.0.price_all }} €
    -
    {% trans 'на все дни' %}
    -
  • - {% endif %} - -
- -
{% trans 'Предварительная регистрация' %}
- -
- -
- -
    - {% if object_list.0.price_day_bar %} -
  • -
    {{ object_list.0.price_day_bar }} €
    - -
    на 1 день
    -
  • - {% endif %} - {% if object_list.0.price_all_bar %} -
  • -
    {{ object_list.0.price_all_bar }} €
    -
    {% trans 'на все дни' %}
    -
  • - {% endif %} - -
- -
{% trans 'Регистрация на' %} {% trans 'стойке' %}
- -
- -
- -
-
{% trans 'Выставка открыта для' %}:
-
    - {{ object_list.0.get_audience }} - -
-
-
- -
- -
-
{% trans 'Для участия' %}
- -
{% trans 'Стоимость аренды 1м²' %}
- -
    - {% if object_list.0.max_closed_equipped_area %} -
  • - -
    {{ object_list.0.max_closed_equipped_area }} €
    -
    {% trans 'оборудованная площадь' %}
    -
  • - {% endif %} - - {% if object_list.0.max_closed_area %} -
  • -
    {{ object_list.0.max_closed_area }} €
    -
    {% trans 'необорудованная площадь' %}
    -
  • - {% endif %} - - {% if object_list.0.max_open_area %} -
  • -
    {{ object_list.0.max_open_area }} €
    -
    {% trans 'открытая площадь' %}
    -
  • - {% endif %} - -
- - {% trans 'Заявка на участие' %} - -
- {% if object_list.0.min_stand_size %} -

{% trans 'Минимальный размер стенда' %} — {{ object_list.0.min_stand_size }}м²

- {% endif %} - {% if object_list.0.registration_payment %} -

{% trans 'Регистрационный взнос' %} — {{ object_list.0.registration_payment }}€

- {% endif %} - {% if object_list.0.application_deadline %} -

{% trans 'Крайний срок подачи заявки' %} — {{ object_list.0.application_deadline }}

- {% endif %} - -
- -
-
-
- -
-
- -
- - -
- -
-{% endblock %} -{% endblock %} -{% endblock %} diff --git a/templates/client/exposition/exposition_programm.html b/templates/client/exposition/exposition_programm.html deleted file mode 100644 index 777847f6..00000000 --- a/templates/client/exposition/exposition_programm.html +++ /dev/null @@ -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 %} -
-
- - -
-
-
- {{ object_list.0.main_title|safe }} -
-
- -
- {% with obj=object_list.0 %} - {% include 'client/includes/show_date_block.html' %} - {% endwith %} -
- {% if object_list.0.place %} -
-
-
- {{ object_list.0.place.address.address }} -
- -
- - -
- {% endif %} - - -
-
-
-
-
Деловая программа
-
- {% for day in object_list.0.get_timetables_days %} -
- -
-
    - {% for pr in object_list.0.business_program.all|timetable_by_day:day %} -
  • -
    -
    -
    {{ pr.begin|date:"G:i" }} – {{ pr.end|date:"G:i" }}
    -
    {{ pr.name }}
    -
    -
    - {{ pr.programe|safe }}{% trans 'Организатор' %}: {{ pr.speaker }} -
    -
    -
    {{ pr.place }}
    -
    -
    -
  • - {% endfor %} -
-
-
- {% endfor %} -
-
- {% with event=exposition filter=filter %} - {% include 'includes/event_steps.html' %} - {% endwith %} - - -
- - -
- -
- {% endblock %} - {% endblock %} -{% endblock %} \ No newline at end of file diff --git a/templates/client/exposition/exposition_statistic.html b/templates/client/exposition/exposition_statistic.html deleted file mode 100644 index 2130aedb..00000000 --- a/templates/client/exposition/exposition_statistic.html +++ /dev/null @@ -1,170 +0,0 @@ -{% extends 'base_catalog.html' %} -{% load static %} -{% load i18n %} -{% load template_filters %} - -{% block content_list %} - - {% block content_text %} - {% block page_body %} -
-
- - -
-
-
- {% if object_list.0.main_title %} - {{ object_list.0.main_title|safe }} - {% else %} - {{ object_list.0.name|safe }} - {% endif %} -
-
- -
- {% with obj=object_list.0 %} - {% include 'client/includes/show_date_block.html' %} - {% endwith %} -
- {% if object_list.0.place %} -
-
-
- {{ object_list.0.place.address.address }} -
- -
- - -
- {% endif %} - - -
-
-
-
-
{% trans 'Статистика' %}
-
- {% for st in object_list.0.statistic.all %} -
- - -
- -
-
- {{ st.visitors }} -
{% trans 'посетителей' %}
-
-
- {{ st.members }} -
{% trans 'учасников' %}
-
-
- -
- {% if object_list.0.place %} -
-
{% trans 'Общая выставочная площадь' %}
- -
{{ object_list.0.place.total_area }} {% trans 'м' %}2
- -
- {% endif %} - -
{{ object_list.0.foundation_year }} год основания
-
- -
-
{% trans 'Страны' %}
- -
-
    -
  • Австралия
  • -
  • Австрия
  • -
  • Азербайджан
  • -
  • Албания
  • -
  • Алжир
  • -
  • Ангола
  • -
- -
    -
  • Андорра
  • -
  • Антигуа
  • -
  • Аргентина
  • -
  • Армения
  • -
  • Афганистан
  • -
  • Багамские острова
  • -
- -
    -
  • Бангладеш
  • -
  • Барбадос
  • -
  • Бахрейн
  • -
  • Белиз
  • -
-
- -
- -
- -
- {% endfor %} -
-
- {% with event=object_list.0 %} - {% include 'includes/event_steps.html' %} - {% endwith %} -
- - - -
- -
- - {% endblock %} - {% endblock %} - -{% endblock %} - diff --git a/templates/client/exposition/expositiontranslation_list.html b/templates/client/exposition/expositiontranslation_list.html deleted file mode 100644 index 1e1e465f..00000000 --- a/templates/client/exposition/expositiontranslation_list.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -
    - {% for exposition in object_list %} -
  • {{ exposition.name }}
  • - {% endfor %} -
- {{ filter }} - - - - \ No newline at end of file diff --git a/templates/client/exposition/photo.html b/templates/client/exposition/photo.html new file mode 100644 index 00000000..a5c6a77d --- /dev/null +++ b/templates/client/exposition/photo.html @@ -0,0 +1,26 @@ +{% extends 'base_catalog.html' %} +{% load i18n %} + +{% block bread_scrumbs %} + +{% 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 %} \ No newline at end of file diff --git a/templates/client/exposition/programm.html b/templates/client/exposition/programm.html index a2dd3beb..6c989a73 100644 --- a/templates/client/exposition/programm.html +++ b/templates/client/exposition/programm.html @@ -19,6 +19,35 @@ {% block content_list %} {% include 'client/includes/exposition/programm.html' with exposition=object %} + {% endblock %} {% block paginator %} diff --git a/templates/client/includes/conference/conference_object.html b/templates/client/includes/conference/conference_object.html index 25af9df2..d17d15c4 100644 --- a/templates/client/includes/conference/conference_object.html +++ b/templates/client/includes/conference/conference_object.html @@ -90,6 +90,9 @@ {% if request.user.is_admin %} {% trans 'изменить' %} {% endif %} + {% if event.photogallery %} + {% trans 'фото' %} + {% endif %} diff --git a/templates/client/includes/conference/photo.html b/templates/client/includes/conference/photo.html new file mode 100644 index 00000000..a21e8a3a --- /dev/null +++ b/templates/client/includes/conference/photo.html @@ -0,0 +1,79 @@ +{% load static %} +{% load i18n %} +{% load template_filters %} + + +{% block page_body %} +
+
+
+ + +
+
+
+ +
+ {% if object.main_title %} +
+ {{ object.main_title|safe }} +
+ {% endif %} + +
+ +
+
+
+ + +
+ +{% endblock %} + +{% block photogallery %} + {% include 'client/popups/photo.html' %} +{% endblock %} +{% block scripts %} + + + +{% endblock %} diff --git a/templates/client/includes/exposition/expo_paid.html b/templates/client/includes/exposition/expo_paid.html index 0fc07f89..74796195 100644 --- a/templates/client/includes/exposition/expo_paid.html +++ b/templates/client/includes/exposition/expo_paid.html @@ -89,6 +89,10 @@ {% if request.user.is_admin %} {% trans 'изменить' %} {% endif %} + + {% if exposition.photogallery %} + {% trans 'фото' %} + {% endif %} diff --git a/templates/client/includes/exposition/exposition_object.html b/templates/client/includes/exposition/exposition_object.html index 19833d5b..01d93f8a 100644 --- a/templates/client/includes/exposition/exposition_object.html +++ b/templates/client/includes/exposition/exposition_object.html @@ -94,6 +94,10 @@ {% if request.user.is_admin %} {% trans 'изменить' %} {% endif %} + {% if exposition.photogallery %} + {% trans 'фото' %} + {% endif %} + diff --git a/templates/client/includes/exposition/photo.html b/templates/client/includes/exposition/photo.html new file mode 100644 index 00000000..a21e8a3a --- /dev/null +++ b/templates/client/includes/exposition/photo.html @@ -0,0 +1,79 @@ +{% load static %} +{% load i18n %} +{% load template_filters %} + + +{% block page_body %} +
+
+
+ + +
+
+
+ +
+ {% if object.main_title %} +
+ {{ object.main_title|safe }} +
+ {% endif %} + +
+ +
+
+
+ + +
+ +{% endblock %} + +{% block photogallery %} + {% include 'client/popups/photo.html' %} +{% endblock %} +{% block scripts %} + + + +{% endblock %} diff --git a/templates/client/includes/exposition/programm.html b/templates/client/includes/exposition/programm.html index 1b6ea56c..c15b53a6 100644 --- a/templates/client/includes/exposition/programm.html +++ b/templates/client/includes/exposition/programm.html @@ -118,7 +118,7 @@ {% endif %} {% endwith %} {% with event=exposition filter=filter %} - {% include 'includes/event_steps.html' %} + {% include 'client/includes/event_steps.html' %} {% endwith %} diff --git a/templates/client/includes/exposition/statistic.html b/templates/client/includes/exposition/statistic.html index ed72dfda..6181a247 100644 --- a/templates/client/includes/exposition/statistic.html +++ b/templates/client/includes/exposition/statistic.html @@ -15,9 +15,7 @@ {% include 'client/includes/show_logo.html' %} {% endwith %} - +
{% if exposition.visitors %} {{ exposition.visitors }} diff --git a/templates/client/includes/paginator.html b/templates/client/includes/paginator.html deleted file mode 100644 index e6bf01a2..00000000 --- a/templates/client/includes/paginator.html +++ /dev/null @@ -1,47 +0,0 @@ -{% load i18n %} -{% load template_filters %} - -{% if page_obj.paginator.num_pages > 1 %} - - {% endif %} \ No newline at end of file diff --git a/templates/client/includes/place/photo.html b/templates/client/includes/place/photo.html index 207c761b..16ade109 100644 --- a/templates/client/includes/place/photo.html +++ b/templates/client/includes/place/photo.html @@ -4,7 +4,7 @@ {% block page_body %} -
+
@@ -28,7 +28,7 @@ @@ -47,7 +47,7 @@
  • - {{ photo.title }} + {{ photo.caption }}
  • {% endfor %} @@ -56,24 +56,19 @@
    - {% 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 %} - + +