forked from wiktor/spejstore-new
Hack: admin props combobox works(?)
This commit is contained in:
parent
154e1079da
commit
027bcfcde5
|
@ -1,10 +1,18 @@
|
||||||
{% extends "admin/change_form.html" %} {% block submit_buttons_top %} {# We want
|
{% extends "admin/change_form.html" %}
|
||||||
add another to be default submit action #}
|
|
||||||
<input type="submit" value="Save" class="hidden" name="_addanother" />
|
{% block submit_buttons_top %}
|
||||||
{{ block.super }} {% endblock %} {% block submit_buttons_bottom %} {# We want
|
{# We want add another to be default submit action #}
|
||||||
add another to be default submit action #}
|
<input type="submit" value="Save" class="hidden" name="_addanother" />
|
||||||
<input type="submit" value="Save" class="hidden" name="_addanother" />
|
{{ block.super }}
|
||||||
{{ block.super }} {% endblock %} {% block content %}{{ block.super }}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block submit_buttons_bottom %}
|
||||||
|
{# We want add another to be default submit action #}
|
||||||
|
<input type="submit" value="Save" class="hidden" name="_addanother" />
|
||||||
|
{{ block.super }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}{{ block.super }}
|
||||||
<script>
|
<script>
|
||||||
django.jQuery(function () {
|
django.jQuery(function () {
|
||||||
function fmt(state) {
|
function fmt(state) {
|
||||||
|
@ -24,6 +32,15 @@ add another to be default submit action #}
|
||||||
django.jQuery(".django-select2[name=parent]").djangoSelect2({
|
django.jQuery(".django-select2[name=parent]").djangoSelect2({
|
||||||
templateResult: fmt,
|
templateResult: fmt,
|
||||||
});
|
});
|
||||||
|
/**
|
||||||
|
* Extremely ugly hack to make sure autocomplete loads for the props
|
||||||
|
* There's like 4 select2 versions and jQuery versions.
|
||||||
|
* I give up trying to make it work in a better way.
|
||||||
|
* This is good enough.
|
||||||
|
*/
|
||||||
|
setTimeout(function () {
|
||||||
|
django.jQuery(".hstore-toggle-txtarea").click().click();
|
||||||
|
}, 100);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue