Calendar days

remotes/origin/1203
Назар Котюк 11 years ago
parent bbc7611646
commit aa922bd15c
  1. 2
      accounts/admin_urls.py
  2. 18
      exposition/management/commands/exposition_load.py
  3. 24
      import_xls/utils.py
  4. 6
      settings/templatetags/template_filters.py
  5. 4
      templates/client/includes/accounts/calendar_table.html
  6. 1
      templates/client/static_client/js/min/_modules/block.common.min.js
  7. 1
      templates/client/static_client/js/min/_modules/block.exposition.list.min.js
  8. 1
      templates/client/static_client/js/min/_modules/block.search.min.js
  9. 1
      templates/client/static_client/js/min/_modules/page.company.min.js
  10. 1
      templates/client/static_client/js/min/_modules/page.events.feed.min.js
  11. 1
      templates/client/static_client/js/min/_modules/page.exposition.object.min.js
  12. 1
      templates/client/static_client/js/min/_modules/page.index.min.js
  13. 1
      templates/client/static_client/js/min/_modules/page.place.object.min.js
  14. 1
      templates/client/static_client/js/min/_modules/page.place.photo.min.js
  15. 1
      templates/client/static_client/js/min/_modules/page.profile.min.js
  16. 7
      templates/client/static_client/js/min/app.min.js

@ -4,7 +4,7 @@ from admin import UserListView
urlpatterns = patterns('', urlpatterns = patterns('',
#url(r'^registration/$', 'accounts.admin.registration'), #url(r'^registration/$', 'accounts.admin.registration'),
#url(r'^create_admin/$', 'accounts.admin.create_admin'), #url(r'^create_admin/$', 'accounts.admin.create_admin'),
#url(r'^create_md5user/$', 'accounts.admin.create_md5'), #url(r'^create_md5user/$', 'accounts.admin.create_md5'),
url(r'^change/(.*)/$', 'accounts.admin.user_change'), url(r'^change/(.*)/$', 'accounts.admin.user_change'),
url(r'^all/$', UserListView.as_view()), url(r'^all/$', UserListView.as_view()),

@ -12,17 +12,21 @@ ITALY_FILE = settings.MEDIA_ROOT+'/import/expo_italy_ru.xlsx'
# moscow 3 exps # moscow 3 exps
F = settings.MEDIA_ROOT+'/import/exp.xlsx' F = settings.MEDIA_ROOT+'/import/exp.xlsx'
LA_FILE = settings.MEDIA_ROOT+'/import/expo_la.xlsx'
NA_EU_ASIA_FILE = settings.MEDIA_ROOT+'/import/expo_na_eu_ sa.xls'
class Command(BaseCommand): class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
f = open(F, 'r') f = open(NA_EU_ASIA_FILE, 'r')
book = xlrd.open_workbook(file_contents=f.read()) book = xlrd.open_workbook(file_contents=f.read())
sheet = book.sheet_by_index(0) sheet = book.sheet_by_index(0)
row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)] row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)]
labels = [label for label in row_list[0]] labels = [label for label in row_list[0]]
for row_number, row in enumerate(row_list[1:]): for row_number, row in enumerate(row_list[1:]):
print(row_number)
if row[0] != '': if row[0] != '':
# in first column ids # in first column ids
@ -68,12 +72,15 @@ class Command(BaseCommand):
else: else:
value = func(cell) value = func(cell)
setattr(object, field_name, value) if field_name == 'city':
object.save() pass
else:
setattr(object, field_name, value)
#object.save()
print('post save %s'% str(object)) print('post save %s'% str(object))
"""
for method in methods: for method in methods:
func = method['func'] func = method['func']
if method.get('purpose'): if method.get('purpose'):
@ -82,4 +89,5 @@ class Command(BaseCommand):
except: except:
continue continue
else: else:
func(object, method['value']) func(object, method['value'])
"""

@ -41,6 +41,7 @@ def to_country(value):
country = query.filter(name=value)[0] country = query.filter(name=value)[0]
return country return country
except IndexError: except IndexError:
print(value.encode('utf8'))
return None return None
def to_city(value, lang, country): def to_city(value, lang, country):
@ -52,9 +53,9 @@ def to_city(value, lang, country):
# print(city) # print(city)
return city return city
except IndexError: except IndexError:
# print('---------------------') print('---------------------')
# print(value.encode('utf8')) print(value.encode('utf8'))
# print('---------------------') print('---------------------')
return None return None
@ -88,7 +89,13 @@ def to_place(value):
place = PlaceExposition.objects.get(url=value) place = PlaceExposition.objects.get(url=value)
return place return place
except PlaceExposition.DoesNotExist: except PlaceExposition.DoesNotExist:
return None
try:
place = PlaceExposition.objects.get(id=value)
return place
except:
return None
def to_periodic(value): def to_periodic(value):
@ -145,7 +152,7 @@ def save_logo(obj, path):
url = 'http://expomap.ru' + path url = 'http://expomap.ru' + path
try: try:
response = urllib2.urlopen(url, timeout=10) response = urllib2.urlopen(url, timeout=15)
except: except:
return None return None
@ -158,7 +165,12 @@ def save_logo(obj, path):
return None return None
obj.logo = logo_path + alt_name obj.logo = logo_path + alt_name
obj.save() try:
obj.save()
except:
print('logo exception. logo: %s'%obj.logo)
return None
def check_quality_label(obj, value, label): def check_quality_label(obj, value, label):

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from django import template from django import template
import phonenumbers import phonenumbers
import datetime, random import datetime, random
@ -228,3 +229,8 @@ def next_monthes(value):
a = value a = value
return value return value
@register.filter
def get_rus_day(date):
days = {1: u'Пн', 2: u'Вт', 3: u'Ср', 4: u'Чт', 5: u'Пт', 6: u'Сб', 0: u'Вс',}
return days.get(date.weekday(), '')

@ -23,12 +23,12 @@
{% for day in days %} {% for day in days %}
{% ifnotequal day current_day %} {% ifnotequal day current_day %}
<td width="115"><div><b>{{ day|date:"d" }}</b>/<i>{{ day|date:"D"|lower }}</i></div></td> <td width="115"><div><b>{{ day|date:"d" }}</b>/<i>{% if LANGUAGE_CODE == 'ru' %}{{ day|get_rus_day }}{% else %}{{ day|date:"D" }}{% endif %}</i></div></td>
{% else %} {% else %}
<td class="c-cur"> <td class="c-cur">
<div> <div>
<div class="cur-mark">{% trans 'Сегодня' %}</div> <div class="cur-mark">{% trans 'Сегодня' %}</div>
<b>{{ day|date:"d" }}</b>/<i>{{ day|date:"D"|lower }}</i> <b>{{ day|date:"d" }}</b>/<i>{% if LANGUAGE_CODE == 'ru' %}{{ day|get_rus_day }}{% else %}{{ day|date:"D" }}{% endif %}</i>
</div> </div>
</td> </td>
{% endifnotequal %} {% endifnotequal %}

@ -0,0 +1 @@
var EXPO=EXPO||{};EXPO.common?console.warn("WARNING: EXPO.common is already defined!"):EXPO.common=function(){var e={},t=function(e,t){return(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector).call(e,t)};e.opt={};var s=function(e){this.fields=[],this.allIsClear=!1,this.ajaxUrl=e.getAttribute("action"),this.DOM=e,this._initFields(),this._eventController()};return s.prototype={_eventController:function(){var e=this;this.DOM.addEventListener?this.DOM.addEventListener("submit",function(t){return e.validate(),t.preventDefault(),!1},!1):this.DOM.attachEvent&&this.DOM.attachEvent("onsubmit",function(t){return e.validate(),t.preventDefault(),!1})},_initFields:function(){},validate:function(){var e,t=this,s=$(t.DOM).serialize(),i={},o="err-message-box",n=t.DOM.querySelector("."+o),a=n.innerHTML,r=function(s){if(e=s,t.unHighlightFields(),e.success)n&&EXPO.common.removeClass(n,"active"),window.location.reload();else{EXPO.common.removeClass(n,"active"),i={},t.fields=[];for(var o in e.errors)e.errors.hasOwnProperty(o)&&("__all__"!=o?(i={name:o,id:"id_"+o,errorText:e.errors[o]},t.fields.push(i)):n&&(EXPO.common.addClass(n,"active"),a.indexOf(e.errors[o])<0&&n.insertAdjacentHTML("beforeend",e.errors[o]+" ")));t.highliteFields()}};t.unHighlightFields(),EXPO.common.postRequest(s,t.ajaxUrl,r)},highliteFields:function(){for(var e,t,s=0;s<this.fields.length;s++)e=this.DOM.querySelector("#"+this.fields[s].id),t=e.parentNode,EXPO.common.addClass(t,"required"),EXPO.common.addClass(t,"err")},unHighlightFields:function(){for(var e,t,s=0;s<this.fields.length;s++)e=this.DOM.querySelector("#"+this.fields[s].id),t=e.parentNode,EXPO.common.removeClass(t,"required"),EXPO.common.removeClass(t,"err")},submit:function(){}},e.forms=[],$(function(){$("form.validate").each(function(){e.forms.push(new s(this))})}),$(function(){$.fn.customRadioCheck=function(){return $(this).each(function(){function e(){if("radio"==s){var e=t.attr("name"),i=$('input[type="radio"]').filter('[name="'+e+'"]');i.each(function(){var e=$(this).closest(".custom-radio");e.removeClass("checked"),$(this).is(":checked")&&e.addClass("checked")})}else t.prop("checked")?o.addClass("checked"):o.removeClass("checked");t.trigger("blur")}var t=$(this),s=t.attr("type"),i=t.closest("label"),o=t.wrap("<span class='custom-"+s+"' />").parent();i.addClass("custom-radio-check"),e(),t.on("change",e)})},$("input[type='checkbox'], input[type='radio']").customRadioCheck()}),e.init=function(e){$.extend(this.opt,e);var t=this,s=this.opt.addCalendarClass,i=this.opt.removeCalendarClass,o=this.opt.addCalendarText,n=this.opt.removeCalendarText;$(function(){$("."+s+", ."+i).on("click",function(e){o=t.opt.addCalendarText,n=t.opt.removeCalendarText,e.preventDefault();var a=$(this),r=a.attr("href");$.get(r,function(e){e.not_authorized?$.fancybox.open("#"+t.opt.loginModalId):e.success&&(e.in?a.removeClass(s).addClass(i).text(n):a.removeClass(i).addClass(s).text(o))})})})},e.hasClass=function(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(el.className)},e.addClass=function(t,s){return e.hasClass(t,s)||(t.classList?t.classList.add(s):t.className+=" "+s),t},e.removeClass=function(t,s){var i=" "+t.className.replace(/[\t\r\n]/g," ")+" ";if(e.hasClass(t,s))if(t.classList)t.classList.remove(s);else{for(;i.indexOf(" "+s+" ")>=0;)i=i.replace(" "+s+" "," ");t.className=i.replace(/^\s+|\s+$/g," ")}return t},e.closest=function(t,s){for(var i=function(s){return e.hasClass(t,s)};t;){if(i(s))return t;t=t.parentNode}},e.children=function(e,s){for(var i,o=[],i=0,n=e.childNodes.length;n>i;++i)t(e.childNodes[i],s)&&o.push(e.childNodes[i]);return o},e.postRequest=function(e,t,s){e||(e=""),$.ajax({type:"POST",url:t,data:e,success:function(e){return"function"!=typeof s?e:(console.log("data recieved:"),console.log(e),console.log(JSON.stringify(e)),s(e),void 0)}})},e.getRequest=function(e,t,s){e||(e=""),$.ajax({type:"GET",url:t,data:e,success:function(e){return"function"!=typeof s?e:(console.log("data recieved:"),console.log(e),console.log(JSON.stringify(e)),s(e),void 0)}})},e.Modal=function(e){var t=this;this.id,this.opt=e,this.DOMwrap=document.getElementById(e.id),this.DOM=this.DOMwrap.querySelector("."+e.wrapClass),$(".modal-close",this.DOM).on("click",function(){t.close()}),$(".modals > *").on("click",function(e){$(e.target.parentNode).find(t.DOMwrap).length&&t.close()})},e.Modal.prototype={pullData:function(e){this.id=e.substr(1),$(e).show().siblings().hide(),this.refresh()},open:function(){$(this.DOMwrap).fadeIn(),e.addClass(document.body,"ov-hidden")},close:function(){$(this.DOMwrap).fadeOut(),e.removeClass(document.body,"ov-hidden")},refresh:function(){var e=this;e.DOM.style.width=e.opt.size[e.id].width+"px",e.DOM.style.minHeight=e.opt.size[e.id].height+"px",e.DOM.style.marginLeft=-(e.opt.size[e.id].width/2)+"px",e.DOM.style.marginTop=-(e.opt.size[e.id].height/2)+"px"}},e}();

@ -0,0 +1 @@
var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.list?console.warn("WARNING: EXPO.place.object is already defined!"):EXPO.exposition.list=function(){var t=EXPO.common,n={},o=function(t,n){this.opt=n,this.DOMthis=t,this.DOMbutton=t.querySelector("."+n.buttonClass),this.DOMinput=t.querySelector("."+n.inputClass),this.inputName=this.DOMinput.getAttribute("name"),this.url=this.DOMbutton.getAttribute("href"),this._controller()};return o.prototype={_init:function(){},_controller:function(){var t=this;$(this.DOMinput).on("blur",function(){t.send()}),$(this.DOMbutton).on("click",function(){return!1})},send:function(){var n,o={},i=this,e=function(t){t.success?(console.log("ok"),$(i.DOMbutton).addClass("active")):console.log("data not send")};o[this.inputName]=this.DOMinput.value,n=t.getRequest(o,this.url,e)}},n.opt={},$(function(){}),n.init=function(n){$.extend(this.opt,n),this.notes=[];var i=this;$("."+this.opt.note.wrapClass).each(function(){var t=new o(this,i.opt.note);i.notes.push(t)}),$("."+this.opt.note.wrapDisabledClass).on("click",function(){return $.fancybox.open("#pw-login"),!1}),t.opt.addCalendarText=this.opt.addCalendarText,t.opt.removeCalendarText=this.opt.removeCalendarText},n}();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.object?console.warn("WARNING: EXPO.exposition.object is already defined!"):EXPO.exposition.object=function(){var t=EXPO.common,n={},o=function(t,n){this.opt=n,this.DOMthis=t,this.DOMbutton=t.querySelector("."+n.buttonClass),this.DOMinput=t.querySelector("."+n.inputClass),this.inputName=this.DOMinput.getAttribute("name"),this.url=this.DOMbutton.getAttribute("href"),this._controller()};return o.prototype={_init:function(){},_controller:function(){var t=this;$(this.DOMinput).on("blur",function(){t.send()}),$(this.DOMbutton).on("click",function(){return!1})},send:function(){var n,o={},e=this,i=function(t){t.success?(console.log("ok"),$(e.DOMbutton).addClass("active")):console.log("data not send")};o[this.inputName]=this.DOMinput.value,n=t.getRequest(o,this.url,i)}},n.opt={},$(function(){}),n.init=function(n){$.extend(this.opt,n);var e=this,i=$(document.getElementById(e.opt.visitButton.visitorsListId)),s=$(document.getElementById(e.opt.visitButton.wrapId));this.notes=[],i.children().length||s.show(),$("."+this.opt.note.wrapClass).each(function(){var t=new o(this,e.opt.note);e.notes.push(t)}),$("."+this.opt.note.wrapDisabledClass).on("click",function(){return $.fancybox.open("#pw-login"),!1}),t.opt.addCalendarText=this.opt.addCalendarText,t.opt.removeCalendarText=this.opt.removeCalendarText},n}();

@ -0,0 +1 @@
var EXPO=EXPO||{};EXPO.index?console.warn("WARNING: EXPO.eventsFeed is already defined!"):EXPO.index=function(){var t={};t.opt={};var n=EXPO.common,i=function(t,n){this.opt=n,this.DOMthis=t,this.DOMbutton=t.querySelector("."+n.buttonClass),this.DOMinput=t.querySelector("."+n.inputClass),this.inputName=this.DOMinput.getAttribute("name"),this.url=this.DOMbutton.getAttribute("href"),this._controller()};return i.prototype={_init:function(){},_controller:function(){var t=this;$(this.DOMinput).on("blur",function(){t.send()}),$(this.DOMbutton).on("click",function(){return!1})},send:function(){var t,i={},o=this,e=function(t){t.success?(console.log("ok"),$(o.DOMbutton).addClass("active")):console.log("data not send")};i[this.inputName]=this.DOMinput.value,t=n.getRequest(i,this.url,e)}},t.init=function(t){$.extend(this.opt,t);var n=this;this.notes=[],$("."+this.opt.note.wrapClass).each(function(){var t=new i(this,n.opt.note);n.notes.push(t)}),$("."+this.opt.note.wrapDisabledClass).on("click",function(){return $.fancybox.open("#pw-login"),!1})},t}();

@ -0,0 +1 @@
var EXPO=EXPO||{};EXPO.place=EXPO.place||{},EXPO.place.object?console.warn("WARNING: EXPO.place.object is already defined!"):EXPO.place.object=function(){var t={},i=function(t,i){this.$annotation=$("."+t.annotationClass,i),this.$fullPart=$("."+t.fullPartClass,i),this.$readMore=$("."+t.readMoreClass,i),this.cutLength=t.cutLength,this.fullText,this.init()};return i.prototype={init:function(){var t=this,i=this.$annotation.html().slice(0,t.cutLength);this.fullText=this.$annotation.html(),this.$annotation.html(i+"..."),this.$fullPart.html(this.fullText)},showMore:function(){this.$readMore.hide(),this.$annotation.hide(),this.$fullPart.removeClass("hidden")},_cutAnnotation:function(){}},t.opt={},$(function(){}),t.init=function(t){$.extend(this.opt,t);var n=this;this.articles=[],$("."+n.opt.article.class).each(function(){var t=new i(n.opt.article,this);t.$readMore.on("click",function(){t.showMore()}),n.articles.push(t)})},t}();

@ -0,0 +1 @@
var EXPO=EXPO||{};EXPO.placePhoto?console.warn("WARNING: EXPO.placePhoto is already defined!"):EXPO.placePhoto=function(){var t={};t.settings={},t.lang={};var n=function(t,n,e,i,o,r,c,a){var d=this;this.currentId=void 0,this.ajaxUrl=i,this.opt={gContainerId:n,mId:t,mTrigger:e,nBtn:o,pBtn:r,cBtn:c,mcId:a},this.$mWindow=void 0,$(function(){d.$mWindow=$("#"+d.opt.mId),d.$mtrigger=$("."+d.opt.mTrigger),d.$nBtn=$("#"+d.opt.nBtn),d.$pBtn=$("#"+d.opt.pBtn),d.$cBtn=$("#"+d.opt.cBtn),d.$mtrigger.on("click",function(){var t;try{t=$(this).children("img").data("image-id"),d.currentId=t}catch(n){console.log(n.message)}return d.show(),!1}),d.$nBtn.off("click"),d.$nBtn.on("click",function(){return d.nextSlide(),!1}),d.$pBtn.off("click"),d.$pBtn.on("click",function(){return d.prevSlide(),!1}),d.$cBtn.off("click"),d.$cBtn.on("click",function(){return d.close(),!1}),d.$mWindow.off("click"),d.$mWindow.on("click",function(t){var n=$(t.target);return n.parents().filter("#"+d.opt.mcId).length<1&&d.close(),!1})})};return n.prototype={_getAjax:function(t,n){var e=this;t||(t=""),$.ajax({type:"GET",url:e.ajaxUrl,data:t,success:function(t){"function"==typeof n?(e.rawData=t,n()):e.rawData=t}})},_renderSlide:function(t,n){var e=this;t&&(e.currentId=t),n?(dna.empty(e.opt.mcId),dna.load(e.opt.mcId,e.ajaxUrl+e.currentId,{callback:n()})):(dna.empty(e.opt.mcId),dna.load(e.opt.mcId,e.ajaxUrl+e.currentId,{empty:!0}))},_getId:function(t){var n=this,e=function(){var t=$("."+n.opt.mTrigger+' [data-image-id="'+n.currentId+'"]').parents("li").next().find("img").data("image-id");t?n.currentId=t:console.log("there is not next slides")},i=function(){var t=$("."+n.opt.mTrigger+' [data-image-id="'+n.currentId+'"]').parents("li").prev().find("img").data("image-id");t?n.currentId=t:console.log("there is not previous slides")},o=function(){console.log("_getId("+t+") RESULTS:"),console.log(n.currentId)};switch(t){case">":e();break;case"<":i();break;default:o()}},close:function(){$("body").removeClass("no-scroll"),this.$mWindow.hide()},open:function(){$("body").addClass("no-scroll"),this.$mWindow.show()},nextSlide:function(){var t=this.currentId;this._getId(">"),t!=this.currentId&&this._renderSlide()},prevSlide:function(){var t=this.currentId;this._getId("<"),t!=this.currentId&&this._renderSlide()},show:function(t){var n=this;this._renderSlide(t,function(){n.open()})}},t.init=function(t){$.extend(this.lang,t.lang),t.lang=null,$.extend(this.settings,t);var e=this;this.modal=new n(e.settings.modalId,e.settings.containerId,e.settings.modalTrigger,e.settings.ajaxUrl,e.settings.nextButtonId,e.settings.prevButtonId,e.settings.closeModalButtonId,e.settings.modalContainerId)},t}();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save