diff --git a/apps/conference/admin.py b/apps/conference/admin.py index 534f71ef..00309bb7 100644 --- a/apps/conference/admin.py +++ b/apps/conference/admin.py @@ -37,7 +37,7 @@ from functions.admin_views import ( AdminListView, AdminView, stat_paginate_results, - upload_photo + # upload_photo ) from functions.custom_views import delete_object, objects_list from functions.views_help import get_referer @@ -45,6 +45,7 @@ from functions.admin import DefaultAdmin from haystack.query import SearchQuerySet from models import Conference, Statistic, TimeTable, Speaker from photologue.forms import PhotoForm +from photologue.admin import upload_photo from theme.models import Tag @@ -349,7 +350,6 @@ class ConferenceListView(AdminListView): model = Conference -# FIXME: WTF? @csrf_exempt def upload_conference_photo(request, conf_id): return upload_photo(request, conf_id, Conference) diff --git a/apps/exposition/admin.py b/apps/exposition/admin.py index 585e53e8..181d1749 100644 --- a/apps/exposition/admin.py +++ b/apps/exposition/admin.py @@ -13,6 +13,7 @@ from django.forms.models import modelformset_factory from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response from django.utils import translation +from django.views.decorators.csrf import csrf_exempt from file.forms import FileForm, FileModelForm from file.models import FileModel, TmpFile from forms import ( @@ -26,13 +27,14 @@ from functions.admin_views import ( AdminListView, AdminView, stat_paginate_results, - upload_photo + # upload_photo ) from functions.custom_views import delete_object, objects_list from functions.views_help import get_referer from haystack.query import SearchQuerySet from models import Exposition, Statistic, TimeTable, TmpTimeTable from photologue.forms import PhotoForm +from photologue.admin import upload_photo from theme.models import Tag @@ -346,6 +348,8 @@ class ExpositionListView(AdminListView): form_class = ExpositionFilterForm model = Exposition + +@csrf_exempt def upload_exposition_photo(request, expo_id): return upload_photo(request, expo_id, Exposition) diff --git a/apps/functions/admin_views.py b/apps/functions/admin_views.py index 9f4c8385..9c4a0151 100644 --- a/apps/functions/admin_views.py +++ b/apps/functions/admin_views.py @@ -147,26 +147,24 @@ class AdminListView(FormView): return context - -# FIXME: WTF? -@csrf_exempt -def upload_photo(request, id, Model): - """ - uploading photo to some instance of Model - instance must have upload_photo method, which download photo - - """ - obj = get_object_or_404(Model, pk=id) - if request.method == 'POST': - response = {'success': False} - form = PhotoForm(request.POST, request.FILES) - if form.is_valid(): - photo = form.save() - obj.upload_photo(photo) - response['success'] = True - else: - response.update({'errors': form.errors}) - - return HttpResponse(json.dumps(response), content_type='application/json') - else: - return HttpResponse('not post') +# @csrf_exempt +# def upload_photo(request, id, Model): +# """ +# uploading photo to some instance of Model +# instance must have upload_photo method, which download photo +# +# """ +# obj = get_object_or_404(Model, pk=id) +# if request.method == 'POST': +# response = {'success': False} +# form = PhotoForm(request.POST, request.FILES) +# if form.is_valid(): +# photo = form.save() +# obj.upload_photo(photo) +# response['success'] = True +# else: +# response.update({'errors': form.errors}) +# +# return HttpResponse(json.dumps(response), content_type='application/json') +# else: +# return HttpResponse('not post') diff --git a/apps/photologue/admin.py b/apps/photologue/admin.py index 3ab13aac..19cc93ba 100644 --- a/apps/photologue/admin.py +++ b/apps/photologue/admin.py @@ -1,26 +1,19 @@ import json -from django import forms + from django.conf import settings -from django.shortcuts import HttpResponse -from django.contrib import admin -from django.contrib.sites.models import Site -from django.contrib import messages -from django.utils.translation import ungettext, ugettext_lazy as _ +from django.shortcuts import HttpResponse, get_object_or_404 +from django.views.generic import ListView, FormView +from django.http import HttpResponseRedirect -from .models import Gallery, Photo, GalleryUpload, PhotoEffect, PhotoSize, \ - Watermark +from .models import Gallery, Photo +from .forms import PhotoForm, GalleryForm -MULTISITE = getattr(settings, 'PHOTOLOGUE_MULTISITE', False) +from sorl.thumbnail import get_thumbnail +MULTISITE = getattr(settings, 'PHOTOLOGUE_MULTISITE', False) ENABLE_TAGS = getattr(settings, 'PHOTOLOGUE_ENABLE_TAGS', False) -#------------------EXPOMAP VIEWS---------------------------------------------- -from django.views.generic import ListView, FormView -from forms import PhotoForm, GalleryForm -from django.shortcuts import render_to_response, get_object_or_404 -from django.http import HttpResponseRedirect - class AdminViewObject(FormView): """ need overwrite get_form method for every class @@ -56,7 +49,6 @@ class AdminViewObject(FormView): return context - class PhotoView(AdminViewObject): model = Photo form_class = PhotoForm @@ -77,14 +69,14 @@ class PhotoView(AdminViewObject): 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 + obj = Photo._meta.translations_model.objects.get(language_code=code, master__id=getattr(photo, 'id')) # access to translated fields data['title_%s' % code] = obj.title data['caption_%s' % code] = obj.caption - #form.fields['tag'].widget.attrs['data-init-text'] = [item.name for item in article.tag.all()] return form_class(data) else: return form_class() + class GalleryView(AdminViewObject): model = Gallery form_class = GalleryForm @@ -103,10 +95,9 @@ class GalleryView(AdminViewObject): data = {} for code, name in settings.LANGUAGES: - obj = Gallery._meta.translations_model.objects.get(language_code = code,master__id=getattr(gallery, 'id')) #access to translated fields + obj = Gallery._meta.translations_model.objects.get(language_code=code, master__id=getattr(gallery, 'id')) # access to translated fields data['title_%s' % code] = obj.title data['description_%s' % code] = obj.description - #form.fields['tag'].widget.attrs['data-init-text'] = [item.name for item in article.tag.all()] return form_class(data) else: return form_class() @@ -124,6 +115,53 @@ class GalleryListView(ListView): template_name = 'c_admin/photogallery/admin_gallery_list.html' +def upload_photo(request, id, Model): + """ + uploading photo to some instance of Model + instance must have upload_photo method, which download photo + """ + def get_images_list(obj): + """ + :param obj: instance of Model + :return: images list + """ + images = [] + if obj.photogallery: + for img in obj.photogallery.photos.all(): + im = get_thumbnail( + img.image, '188x143', crop='center', quality=99 + ) + images.append({ + 'name': img.title or img.image.name, + 'size': img.image.size, + 'file': im.url, + 'type': 'image', + 'remove_url': img.get_delete_url(), + 'detail_link': img.admin_url() + }) + return images + + data = {'success': False} + obj = get_object_or_404(Model, pk=id) + + if request.is_ajax() and request.method == 'POST': + form = PhotoForm(request.POST, request.FILES) + + if form.is_valid(): + photo = form.save() + obj.upload_photo(photo) + + data['success'] = True + else: + data['errors'] = form.errors + + elif request.is_ajax() and request.method == 'GET': + data['success'] = True + data['images'] = get_images_list(obj) + + return HttpResponse(json.dumps(data), content_type='application/json') + + def delete_photo(request, photo_id): photo = get_object_or_404(Photo, pk=photo_id) photo.delete() diff --git a/apps/place_exposition/admin.py b/apps/place_exposition/admin.py index 140ecffe..09b6b724 100644 --- a/apps/place_exposition/admin.py +++ b/apps/place_exposition/admin.py @@ -11,11 +11,12 @@ from django.contrib.auth.decorators import login_required from django.forms.formsets import formset_factory from django.forms.models import modelformset_factory from django.utils.translation import get_language +from django.views.decorators.csrf import csrf_exempt from haystack.query import SearchQuerySet from functions.custom_views import objects_list, delete_object from functions.views_help import get_referer -from functions.admin_views import AdminView, AdminListView, upload_photo, FormView +from functions.admin_views import AdminView, AdminListView # , upload_photo, FormView from functions.http import JsonResponse from exposition.admin import get_by_lang @@ -25,6 +26,7 @@ from city.models import City from file.models import FileModel, TmpFile from file.forms import FileModelForm, FileForm from photologue.forms import PhotoForm +from photologue.admin import upload_photo from place_conference.models import PlaceConference from place_exposition.models import PlaceExposition @@ -285,7 +287,7 @@ class PlaceExpositionListView(AdminListView): model = PlaceExposition - +@csrf_exempt def upload_place_photo(request, place_id): return upload_photo(request, place_id, PlaceExposition) diff --git a/static/custom_js/main.js b/static/custom_js/main.js index 29559540..1d1d6b80 100644 --- a/static/custom_js/main.js +++ b/static/custom_js/main.js @@ -235,7 +235,7 @@ $(document).ready(function(){ return false; }); // end on-of events - if( $("#id_city" ).length ) { + if( $("#id_city" ).length && $("#id_city" ).is('select') ) { $('#id_city').select2({ placeholder: "Город", width: 'element', @@ -275,7 +275,7 @@ $(document).ready(function(){ }); } - if( $("#id_main_page_news" ).length ) { + if( $("#id_main_page_news" ).length && $("#id_main_page_news").is('select')) { $('#id_main_page_news').select2({ placeholder: "Новости", multiple: true, @@ -325,7 +325,7 @@ $(document).ready(function(){ } - if( $("#id_tag" ).length ) { + if( $("#id_tag" ).length && $("#id_tag").is('select')) { $('#id_tag').select2({ placeholder: "Теги", width: '550px', @@ -490,13 +490,17 @@ $(document).ready(function(){ } }); }); - if($('select').length){ - $('select').select2({ - width: 'element', - allowClear: true - }); - } + /* FIXME: Проверить все select2 */ + // if($('select').length){ + // try{ + // $('select').select2({ + // width: 'element', + // allowClear: true + // + // }); + // } catch (e){} + // } diff --git a/static/custom_js/make_select.js b/static/custom_js/make_select.js deleted file mode 100644 index 26362dd1..00000000 --- a/static/custom_js/make_select.js +++ /dev/null @@ -1,94 +0,0 @@ -//replace -$(document).ready(function(){ - //$('#id_city').attr('disabled', true) - - $('select').select2({ - width: 'element', - allowClear: true - - });//end select - - - - $('#id_city').select2({ - placeholder: "Search city", - width: 'element', - ajax: { - - url: "/admin/city/search/", - dataType: "json", - quietMillis: 200, - - data: function(term, page, country){ - var country = $('#id_country').val() - return {term: term, - page: page, - country: country}; - }, - - results: function (data) { - var results = []; - $.each(data, function(index, item){ - results.push({ - id: item.id, - text: item.label - }); - }); - return {results: results}; - } - }, - initSelection : function(element, callback) { - var id= $(element).val(); - var text = $(element).attr('data-init-text'); - callback({id: id, text:text}); - - } - - }); - - // - $('#id_tag').select2({ - placeholder: "Search tag", - width: '550px', - multiple: true, - ajax: { - - url: "/admin/theme/tag/search/", - dataType: "json", - quietMillis: 200, - multiple: true, - - data: function(term, page, theme){ - var theme = $('#id_theme').serialize(); - return {term: term, - page: page, - theme: theme}; - }, - - results: function (data) { - var results = []; - $.each(data, function(index, item){ - results.push({ - id: item.id, - text: item.label - }); - }); - return {results: results}; - } - }, - initSelection : function(element, callback) { - var data = []; - $(element.val().split(",")).each(function(i) { - var item = this.split(':'); - data.push({ - id: item[0], - text: item[1] - }); - }); - callback(data); - - } - - }); - -})//end ready diff --git a/static/jQuery-filer/js/init.js b/static/jQuery-filer/js/init.js index f493c623..4b2b3a65 100644 --- a/static/jQuery-filer/js/init.js +++ b/static/jQuery-filer/js/init.js @@ -1,195 +1,167 @@ function init_filer($target) { - $target.find('.file_uploader').filer({ - limit: null, - maxSize: null, - extensions: null, - changeInput: '

Drag&Drop files here

or
Browse Files
', - showThumbs: true, - theme: "dragdropbox", - afterRender: function(l, p, o, s){ - s[0].name = s[0].name.replace('[]', '') - }, - templates: { - box: '', - item: '
  • \ -
    \ -
    \ - \ -
    \ -
    \ -
    \ -
    \ - {{fi-name}}\ - {{fi-size2}}\ -
    \ -
    \ -
    \ - {{fi-image}}\ -
    \ -
    \ -
      \ -
    • {{fi-progressBar}}
    • \ -
    \ -
      \ -
    • \ -
    \ -
    \ -
    \ -
    \ -
  • ', - itemAppend: '
  • \ -
    \ -
    \ - \ -
    \ -
    \ -
    \ -
    \ - {{fi-name}}\ - {{fi-size2}}\ -
    \ -
    \ -
    \ - {{fi-image}}\ -
    \ -
    \ -
      \ -
    • {{fi-icon}}
    • \ -
    \ -
      \ -
    • {{fi-remove}}
    • \ -
    \ -
    \ -
    \ -
    \ -
  • ', - progressBar: '
    ', - itemAppendToEnd: true, - canvasImage: true, - removeConfirmation: true, - _selectors: { - list: '.jFiler-items-list', - //item: '.jFiler-item', - progressBar: '.bar', - remove: '.jFiler-item-trash-action' - } - }, - dragDrop: { - dragEnter: null, - dragLeave: null, - drop: null, - dragContainer: null - }, - uploadFile: { - url: $target.data('upload-url'), - //data: null, - type: 'POST', - enctype: 'multipart/form-data', - synchron: true, - beforeSend: function() {}, - success: function(data, itemEl, listEl, boxEl, newInputEl, inputEl, id){ - console.log(data); - console.log(itemEl); - console.log(listEl); - console.log(boxEl); - console.log(newInputEl); - console.log(inputEl); - console.log(id); - console.log('----------------------------'); - var parent = itemEl.find(".jFiler-jProgressBar").parent(); - itemEl.find(".jFiler-jProgressBar").fadeOut("slow", function(){ - $("
    Success
    ").hide().appendTo(parent).fadeIn("slow"); - }); - }, - error: function(el){ - var parent = el.find(".jFiler-jProgressBar").parent(); - el.find(".jFiler-jProgressBar").fadeOut("slow", function(){ - $("
    Error
    ").hide().appendTo(parent).fadeIn("slow"); - }); - }, - statusCode: null, - onProgress: null, - onComplete: null - }, - files: [ - { - name: "appended_file.jpg", - size: 5453, - type: "image", - file: "http://127.0.0.1:8000/media/photologue/photos/cache/am_admin_thumbnail.jpg", // 188x143 crop="center" - url: "google.com.ua", - remove_url: '/remove-url/1/', - detail_link: '/detail_link/1/' - }, - { - name: "appended_file_2.jpg", - size: 9453, - type: "image", - file: "http://127.0.0.1:8000/media/photologue/photos/cache/am_admin_thumbnail.jpg", // 188x143 crop="center" - url: "/qwerty/qwerty/", - remove_url: '/remove-url/2/', - detail_link: '/detail_link/1/' - }, - { - name: "appended_file_2.jpg", - size: 9453, - type: "image", - file: "http://127.0.0.1:8000/media/photologue/photos/cache/am_admin_thumbnail.jpg", // 188x143 crop="center" - url: "/qwerty/qwerty/", - remove_url: '/remove-url/3/', - detail_link: '/detail_link/1/' - } - ], - addMore: false, - allowDuplicates: true, - clipBoardPaste: true, - excludeName: null, - beforeRender: null, - beforeShow: null, - beforeSelect: null, - onSelect: null, - afterShow: null, - onRemove: function(itemEl, file, id, listEl, boxEl, newInputEl, inputEl){ - var filerKit = inputEl.prop("jFiler"), - file_name = filerKit.files_list[id].name; + $.get($target.data('upload-url'), function(response){ + var files = []; + if (response['success']) { + files = response['images']; + } - $.post('./php/ajax_remove_file.php', {file: file_name}); - }, - onEmpty: null, - options: null, - dialogs: { - alert: function(text) { - return alert(text); - }, - confirm: function (text, callback) { - confirm(text) ? callback() : null; - } - }, - captions: { - button: "Выберите файлы", - feedback: "Выберите файлы для загрузки", - feedback2: "выбранные файлы", - drop: "Перетяните файлы для загрузки", - removeConfirmation: "Вы уверены что хотите удалить этот файл?", - errors: { - filesLimit: "Only {{fi-limit}} files are allowed to be uploaded.", - filesType: "Only Images are allowed to be uploaded.", - filesSize: "{{fi-name}} is too large! Please upload file up to {{fi-maxSize}} MB.", - filesSizeAll: "Files you've choosed are too large! Please upload files up to {{fi-maxSize}} MB." - } - } - }); + $target.find('.file_uploader').filer({ + limit: null, + maxSize: null, + extensions: null, + changeInput: '

    Drag&Drop files here

    or
    Browse Files
    ', + showThumbs: true, + theme: "dragdropbox", + afterRender: function(l, p, o, s){ + s[0].name = s[0].name.replace('[]', '') + }, + templates: { + box: '', + item: '
  • \ +
    \ +
    \ + \ +
    \ +
    \ +
    \ +
    \ + {{fi-name}}\ + {{fi-size2}}\ +
    \ +
    \ +
    \ + {{fi-image}}\ +
    \ +
    \ +
      \ +
    • {{fi-progressBar}}
    • \ +
    \ +
      \ +
    • \ +
    \ +
    \ +
    \ +
    \ +
  • ', + itemAppend: '
  • \ +
    \ +
    \ + \ +
    \ +
    \ +
    \ +
    \ + {{fi-name}}\ + {{fi-size2}}\ +
    \ +
    \ +
    \ + {{fi-image}}\ +
    \ +
    \ +
      \ +
    • {{fi-icon}}
    • \ +
    \ +
      \ +
    • {{fi-remove}}
    • \ +
    \ +
    \ +
    \ +
    \ +
  • ', + progressBar: '
    ', + itemAppendToEnd: true, + canvasImage: true, + removeConfirmation: true, + _selectors: { + list: '.jFiler-items-list', + //item: '.jFiler-item', + progressBar: '.bar', + remove: '.jFiler-item-trash-action' + } + }, + dragDrop: { + dragEnter: null, + dragLeave: null, + drop: null, + dragContainer: null + }, + uploadFile: { + url: $target.data('upload-url'), + //data: null, + type: 'POST', + enctype: 'multipart/form-data', + synchron: true, + beforeSend: function() {}, + success: function(data, itemEl, listEl, boxEl, newInputEl, inputEl, id){ + var parent = itemEl.find(".jFiler-jProgressBar").parent(); + itemEl.find(".jFiler-jProgressBar").fadeOut("slow", function(){ + $("
    Success
    ").hide().appendTo(parent).fadeIn("slow"); + }); + }, + error: function(el){ + var parent = el.find(".jFiler-jProgressBar").parent(); + el.find(".jFiler-jProgressBar").fadeOut("slow", function(){ + $("
    Error
    ").hide().appendTo(parent).fadeIn("slow"); + }); + }, + statusCode: null, + onProgress: null, + onComplete: null + }, + files: files, + addMore: false, + allowDuplicates: true, + clipBoardPaste: true, + excludeName: null, + beforeRender: null, + beforeShow: null, + beforeSelect: null, + onSelect: null, + afterShow: null, + onRemove: function(itemEl, file, id, listEl, boxEl, newInputEl, inputEl){ + var filerKit = inputEl.prop("jFiler"), + file_name = filerKit.files_list[id].name; + console.log(itemEl); + + $.get(itemEl.find('.jFiler-item-trash-action').attr('href')) + }, + onEmpty: null, + options: null, + dialogs: { + alert: function(text) { + return alert(text); + }, + confirm: function (text, callback) { + confirm(text) ? callback() : null; + } + }, + captions: { + button: "Выберите файлы", + feedback: "Выберите файлы для загрузки", + feedback2: "выбранные файлы", + drop: "Перетяните файлы для загрузки", + removeConfirmation: "Вы уверены что хотите удалить этот файл?", + errors: { + filesLimit: "Only {{fi-limit}} files are allowed to be uploaded.", + filesType: "Only Images are allowed to be uploaded.", + filesSize: "{{fi-name}} is too large! Please upload file up to {{fi-maxSize}} MB.", + filesSizeAll: "Files you've choosed are too large! Please upload files up to {{fi-maxSize}} MB." + } + } + }); + }); } var $uploaders = $('.file_upload_container'); $uploaders.each(function (i, uploader) { - var $uploader = $(uploader), - fields = $uploader.data('fields').split('|'), // Массив названий полей для создания фото - languages = $uploader.data('languages').split('|'); // Массив языков, будет использоватся для генерации инпутов + var $uploader = $(uploader), + fields = $uploader.data('fields').split('|'), // Массив названий полей для создания фото + languages = $uploader.data('languages').split('|'); // Массив языков, будет использоватся для генерации инпутов - init_filer($uploader); -}); \ No newline at end of file + init_filer($uploader); +}); diff --git a/templates/c_admin/accounts/user_change.html b/templates/c_admin/accounts/user_change.html index cff1f51f..ef528354 100644 --- a/templates/c_admin/accounts/user_change.html +++ b/templates/c_admin/accounts/user_change.html @@ -7,7 +7,6 @@ {# selects #} - - -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/c_admin/article/article_add.html b/templates/c_admin/article/article_add.html index 488593cc..5589009b 100644 --- a/templates/c_admin/article/article_add.html +++ b/templates/c_admin/article/article_add.html @@ -8,7 +8,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/article/blog_form.html b/templates/c_admin/article/blog_form.html index d1630cfe..a4aaef90 100644 --- a/templates/c_admin/article/blog_form.html +++ b/templates/c_admin/article/blog_form.html @@ -9,7 +9,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/blog/blog_add.html b/templates/c_admin/blog/blog_add.html index f286cd5b..43d730b5 100644 --- a/templates/c_admin/blog/blog_add.html +++ b/templates/c_admin/blog/blog_add.html @@ -7,7 +7,6 @@ {# selects #} - {# ajax #} @@ -22,4 +21,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/c_admin/city/city_add.html b/templates/c_admin/city/city_add.html index 3af7fda1..73972656 100644 --- a/templates/c_admin/city/city_add.html +++ b/templates/c_admin/city/city_add.html @@ -8,7 +8,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/company/company_add.html b/templates/c_admin/company/company_add.html index 0ad489a5..adc6d937 100644 --- a/templates/c_admin/company/company_add.html +++ b/templates/c_admin/company/company_add.html @@ -14,7 +14,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/conference/conference.html b/templates/c_admin/conference/conference.html index 1eae47b4..c5d5ab6a 100644 --- a/templates/c_admin/conference/conference.html +++ b/templates/c_admin/conference/conference.html @@ -574,7 +574,6 @@ -{% include 'c_admin/includes/photo_form.html' with form=photo_form object=object %} {% include 'c_admin/includes/file_form.html' with file_form=file_form object=object %} {% include 'c_admin/includes/stat_form.html' with form=stat_form object=object %} {% endblock %} diff --git a/templates/c_admin/conference/conference_add.html b/templates/c_admin/conference/conference_add.html index 0f3118bc..3c44b2b6 100644 --- a/templates/c_admin/conference/conference_add.html +++ b/templates/c_admin/conference/conference_add.html @@ -9,7 +9,6 @@ {# selects #} - {# datetimepicker #} diff --git a/templates/c_admin/country/country_add.html b/templates/c_admin/country/country_add.html index c0cacd77..f57df259 100644 --- a/templates/c_admin/country/country_add.html +++ b/templates/c_admin/country/country_add.html @@ -10,7 +10,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/exposition/exposition.html b/templates/c_admin/exposition/exposition.html index ab547093..169cf2dd 100644 --- a/templates/c_admin/exposition/exposition.html +++ b/templates/c_admin/exposition/exposition.html @@ -492,54 +492,7 @@ Добавить год - - - {% else %} - {% endif %} - {% comment %} - {% if formset_statistic.errors %} -
    - {% for form in formset_statistic.forms %} - - {% for key, value in form.errors.items %} -

    {{ value }}

    - {% endfor %} - - {% endfor %} -
    {% endif %} - - {# formset of stat #} - {{ formset_statistic.management_form }} - -
    - - - - - - - - - - - - - {% for form in formset_statistic.forms %} - - - - - - - - {% endfor %} - -
    ГодПосетителиУчастникиПлощадь
    {{ form.year }}{{ form.visitors }}{{ form.members }}{{ form.area }} Удалить
    -
    -

    Добавить год

    - - {% endcomment %}
    @@ -661,7 +614,6 @@
    -{% include 'c_admin/includes/photo_form.html' with form=photo_form object=object %} {% include 'c_admin/includes/file_form.html' with file_form=file_form object=object %} {% include 'c_admin/includes/stat_form.html' with form=stat_form object=object %} {% endblock %} diff --git a/templates/c_admin/exposition/exposition_add.html b/templates/c_admin/exposition/exposition_add.html index f2ee8271..5a60189c 100644 --- a/templates/c_admin/exposition/exposition_add.html +++ b/templates/c_admin/exposition/exposition_add.html @@ -18,7 +18,6 @@ {# #} - {# ajax #} diff --git a/templates/c_admin/import templates/export.html b/templates/c_admin/import templates/export.html index aa3f58fa..02e66c4d 100644 --- a/templates/c_admin/import templates/export.html +++ b/templates/c_admin/import templates/export.html @@ -5,7 +5,6 @@ {# selects #} - {# datetimepicker #} @@ -117,4 +116,4 @@ {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/c_admin/import templates/export_event.html b/templates/c_admin/import templates/export_event.html index 8ec43c58..e2b8284d 100644 --- a/templates/c_admin/import templates/export_event.html +++ b/templates/c_admin/import templates/export_event.html @@ -5,7 +5,6 @@ {# selects #} - {# datetimepicker #} @@ -99,4 +98,4 @@ {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/c_admin/includes/photogallery.html b/templates/c_admin/includes/photogallery.html index 3e1d3fa3..db816201 100644 --- a/templates/c_admin/includes/photogallery.html +++ b/templates/c_admin/includes/photogallery.html @@ -6,77 +6,22 @@
    {% if object %} - Фото - Просмотреть галерею

    - {% else %} -

    Фото можна добавлять только после введения основных даных

    - {% endif %} +
    - {% with photos=object.photogallery.photos.all %} -
    - {% for photo in photos %} - -
    - -
    - - {{ photo.title }} - -
    -
    - {% endfor %} +
    - {% endwith %} - - -{#
    #} -{# {% csrf_token %}#} - -{#
    #} -{# #} -{#
    #} -{# {{ form.image }}#} -{# {{ form.image.errors }}#} -{#
    #} -{#
    #} - -{#
    #} -{# #} -{#
    {{ form.sort }}#} -{# {{ form.sort.errors }}#} -{#
    #} -{#
    #} -{# {% with field='caption' form=form languages=languages %}#} -{# {% include 'c_admin/forms/multilang.html' %}#} -{# {% endwith %}#} -{##} -{# {% with field='title' form=form languages=languages %}#} -{# {% include 'c_admin/forms/multilang.html' %}#} -{# {% endwith %}#} -{##} -{#
    #} -{# #} -{#
    #} -{#
    #} + + - - - - - - - + + + {% else %} +

    Изображения можно добавлять только после введения основных данных

    + {% endif %}
    -
    \ No newline at end of file + diff --git a/templates/c_admin/meta/create_seo_text.html b/templates/c_admin/meta/create_seo_text.html index 04182684..818cbfb8 100644 --- a/templates/c_admin/meta/create_seo_text.html +++ b/templates/c_admin/meta/create_seo_text.html @@ -8,7 +8,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/meta/meta_setting.html b/templates/c_admin/meta/meta_setting.html index d4b3dc55..92a86dae 100644 --- a/templates/c_admin/meta/meta_setting.html +++ b/templates/c_admin/meta/meta_setting.html @@ -8,7 +8,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/news/news_add.html b/templates/c_admin/news/news_add.html index 82725dc8..a334cd22 100644 --- a/templates/c_admin/news/news_add.html +++ b/templates/c_admin/news/news_add.html @@ -8,7 +8,6 @@ {# selects #} - {# datetimepicker #} diff --git a/templates/c_admin/organiser/organiser_add.html b/templates/c_admin/organiser/organiser_add.html index 7397feaf..a676f2dd 100644 --- a/templates/c_admin/organiser/organiser_add.html +++ b/templates/c_admin/organiser/organiser_add.html @@ -14,7 +14,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/page/new_page.html b/templates/c_admin/page/new_page.html index 8fed1258..427c67ae 100644 --- a/templates/c_admin/page/new_page.html +++ b/templates/c_admin/page/new_page.html @@ -8,7 +8,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/photogallery/admin_gallery.html b/templates/c_admin/photogallery/admin_gallery.html index a94902d3..ca732b0b 100644 --- a/templates/c_admin/photogallery/admin_gallery.html +++ b/templates/c_admin/photogallery/admin_gallery.html @@ -8,7 +8,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/photogallery/admin_photo.html b/templates/c_admin/photogallery/admin_photo.html index e90f7a6f..610a38c0 100644 --- a/templates/c_admin/photogallery/admin_photo.html +++ b/templates/c_admin/photogallery/admin_photo.html @@ -9,7 +9,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/photoreport/photoreport_add.html b/templates/c_admin/photoreport/photoreport_add.html index 1b6470fd..32cc583a 100644 --- a/templates/c_admin/photoreport/photoreport_add.html +++ b/templates/c_admin/photoreport/photoreport_add.html @@ -7,7 +7,6 @@ {# selects #} - {% endblock %} diff --git a/templates/c_admin/place_conference/place_conference.html b/templates/c_admin/place_conference/place_conference.html index 3f56a62c..1f37bb71 100644 --- a/templates/c_admin/place_conference/place_conference.html +++ b/templates/c_admin/place_conference/place_conference.html @@ -22,7 +22,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/place_conference/place_conference_add.html b/templates/c_admin/place_conference/place_conference_add.html index 0c254909..f38d3ce6 100644 --- a/templates/c_admin/place_conference/place_conference_add.html +++ b/templates/c_admin/place_conference/place_conference_add.html @@ -2,25 +2,21 @@ {% load static %} {% block scripts %} - {# google map не забыть скачать скрипты на локал #} - {# selects #} - - - - {# ajax #} +{% endblock %} - - - +{% block select2 %} + + + {% endblock %} {% block body %} @@ -389,54 +385,54 @@ {# modal window #} -#} {% endblock %} diff --git a/templates/c_admin/place_exposition/hall.html b/templates/c_admin/place_exposition/hall.html index 00a4f79d..40b3306e 100644 --- a/templates/c_admin/place_exposition/hall.html +++ b/templates/c_admin/place_exposition/hall.html @@ -12,7 +12,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/place_exposition/place_exposition.html b/templates/c_admin/place_exposition/place_exposition.html index aa8b25b8..a7a62788 100644 --- a/templates/c_admin/place_exposition/place_exposition.html +++ b/templates/c_admin/place_exposition/place_exposition.html @@ -22,7 +22,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/place_exposition/place_exposition_add.html b/templates/c_admin/place_exposition/place_exposition_add.html index 5934fe32..9b58efa3 100644 --- a/templates/c_admin/place_exposition/place_exposition_add.html +++ b/templates/c_admin/place_exposition/place_exposition_add.html @@ -12,7 +12,6 @@ {# selects #} - {# ajax #} diff --git a/templates/c_admin/seminar/seminar_add.html b/templates/c_admin/seminar/seminar_add.html index 2c7543c3..fd96f41d 100644 --- a/templates/c_admin/seminar/seminar_add.html +++ b/templates/c_admin/seminar/seminar_add.html @@ -14,7 +14,6 @@ {# selects #} - {# datetimepicker #} diff --git a/templates/c_admin/service/service_add.html b/templates/c_admin/service/service_add.html index 1b94196a..631d6f8f 100644 --- a/templates/c_admin/service/service_add.html +++ b/templates/c_admin/service/service_add.html @@ -8,7 +8,6 @@ {# selects #} -