You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.9 KiB
125 lines
3.9 KiB
{% extends 'base.html' %}
|
|
{% load static %}
|
|
{% load i18n %}
|
|
|
|
{% block scripts %}
|
|
{# selects #}
|
|
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/>
|
|
<script src="{% static 'js/select/select2.js' %}"></script>
|
|
<script src="{% static 'js/select/select2_locale_ru.js' %}"></script>
|
|
<script>
|
|
$(function(){
|
|
$('#id_fr').datetimepicker({
|
|
todayHighlight: true,
|
|
format : 'yyyy-mm-dd',
|
|
minView:2
|
|
});
|
|
$('#id_to').datetimepicker({
|
|
todayHighlight: true,
|
|
format : 'yyyy-mm-dd',
|
|
minView:2
|
|
});
|
|
$('#id_theme').select2({width: "element"});
|
|
$('#id_country').select2({width: "element"});
|
|
$('#id_month').select2({width: "element"});
|
|
$('#id_cities').select2({
|
|
placeholder: $(this).attr('города'),
|
|
multiple: true,
|
|
width: 'element',
|
|
ajax: {
|
|
|
|
url: "/city/get-city/",
|
|
dataType: "json",
|
|
quietMillis: 200,
|
|
|
|
data: function(term, page){
|
|
return {term: term,
|
|
page: page};
|
|
},
|
|
|
|
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 = JSON.parse(element.attr('data-init-text'));
|
|
callback(_data);
|
|
},
|
|
minimumInputLength: 1,
|
|
|
|
});
|
|
|
|
$('#id_exposition').select2({
|
|
placeholder: 'Найти',
|
|
width: 'element',
|
|
ajax: {
|
|
url: '/admin/exposition/search/',
|
|
dataType: "json",
|
|
quietMillis: 200,
|
|
multiple: true,
|
|
|
|
data: function(term, page, theme){
|
|
return {term: term,
|
|
page: page};
|
|
},
|
|
|
|
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});
|
|
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|
|
{% endblock %}
|
|
|
|
{% block body %}
|
|
<form method="post" class="form-horizontal" name="form2" id="form2" enctype="multipart/form-data"> {% csrf_token %}
|
|
<div class="box span8">
|
|
<div class="box-header well">
|
|
<h2><i class="icon-pencil"></i>{{ form.verbose }} {% if object %}{{ object.get_event }}{% endif %}</h2>
|
|
</div>
|
|
<div class="box-content">
|
|
{% for fieldset in form.fieldsets %}
|
|
<fieldset>
|
|
<legend>{{ fieldset.title }}</legend>
|
|
{% for field in fieldset.fields %}
|
|
<div class="control-group {% if field.errors %}error{% endif %}">
|
|
<label class="control-label">{% if field.field.required %}<b>{{ field.label }}:</b>{% else %}{{ field.label }}{% endif %}</label>
|
|
<div class="controls">{{ field }}
|
|
<span class="help-inline">{{ field.errors }}</span>
|
|
<p class="help-block">{{ field.help_text }}</p>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</fieldset>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="controls">
|
|
<input class="btn btn-large btn-primary" type="submit" value="Готово">
|
|
<input class="btn btn-large" type="reset" value="Отмена">
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|
|
|