parent
48ffa7fa35
commit
9e19d6c57d
5 changed files with 196 additions and 4 deletions
@ -0,0 +1,155 @@ |
|||||||
|
{% extends 'base.html' %} |
||||||
|
{% load static %} |
||||||
|
|
||||||
|
{% block scripts %} |
||||||
|
|
||||||
|
{# selects #} |
||||||
|
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/> |
||||||
|
<style > |
||||||
|
ul{ |
||||||
|
list-style: none; |
||||||
|
} |
||||||
|
</style> |
||||||
|
<script src="{% static 'js/select/select2.js' %}"></script> |
||||||
|
|
||||||
|
<script> |
||||||
|
$(document).ready(function () { |
||||||
|
$('#id_expos').select2({ |
||||||
|
placeholder: "Expositions", |
||||||
|
width: 'element', |
||||||
|
multiple: true, |
||||||
|
ajax: { |
||||||
|
|
||||||
|
url: "/admin/exposition/search/", |
||||||
|
dataType: "json", |
||||||
|
quietMillis: 200, |
||||||
|
multiple: true, |
||||||
|
|
||||||
|
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 = []; |
||||||
|
$(element.val().split(",")).each(function (i) { |
||||||
|
var item = this.split(':'); |
||||||
|
data.push({ |
||||||
|
id: item[0], |
||||||
|
text: item[1] |
||||||
|
}); |
||||||
|
}); |
||||||
|
callback(data); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
$('#id_confs').select2({ |
||||||
|
placeholder: "Conferences", |
||||||
|
width: 'element', |
||||||
|
multiple: true, |
||||||
|
ajax: { |
||||||
|
|
||||||
|
url: "/admin/conference/search/", |
||||||
|
dataType: "json", |
||||||
|
quietMillis: 200, |
||||||
|
multiple: true, |
||||||
|
|
||||||
|
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 = []; |
||||||
|
$(element.val().split(",")).each(function (i) { |
||||||
|
var item = this.split(':'); |
||||||
|
data.push({ |
||||||
|
id: item[0], |
||||||
|
text: item[1] |
||||||
|
}); |
||||||
|
}); |
||||||
|
callback(data); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
</script> |
||||||
|
|
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
{% block body %} |
||||||
|
|
||||||
|
{# Uses multilang.html template for translated fields #} |
||||||
|
<form class="form-horizontal" method="get" action="" > |
||||||
|
{{ form.errors }} |
||||||
|
<div class="form-group"> |
||||||
|
<label class="col-sm-2 control-label">Type:</label> |
||||||
|
<div id = 'types' class="col-sm-10"> |
||||||
|
{{ form.type }} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="col-sm-2 control-label">Countries:</label> |
||||||
|
<div class="col-sm-10"> |
||||||
|
{{ form.countries }} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="row"> |
||||||
|
<label class="col-sm-4 control-label">All:</label> |
||||||
|
<div class="col-sm-8"> |
||||||
|
{{ form.all_counties }} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="form-group"> |
||||||
|
<label class="col-sm-2 control-label">Expos:</label> |
||||||
|
<div class="col-sm-10"> |
||||||
|
{{ form.expos }} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="col-sm-2 control-label">Conferences:</label> |
||||||
|
<div class="col-sm-10"> |
||||||
|
{{ form.confs }} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<div class="col-sm-offset-2 col-sm-10"> |
||||||
|
<button type="submit" class="btn btn-default">Submit</button> |
||||||
|
<button type="reset" class="btn">Reset</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
|
||||||
|
|
||||||
|
{% endblock %} |
||||||
Loading…
Reference in new issue