This is DJANGO-ADMIN! fix #300

This commit is contained in:
Daniel Greenfeld 2013-07-07 14:19:23 +02:00
parent 35b1125429
commit 506f58f705
4 changed files with 26 additions and 8 deletions

View file

@ -8,6 +8,7 @@ MODEL_ADMIN_ATTRS = (
'search_fields',
'index_view', 'detail_view', 'create_view', 'update_view', 'delete_view',
'get_default_view_kwargs', 'get_list_actions',
'actions_on_bottom',)
'actions_on_bottom', 'actions_on_top',
'save_on_top', 'save_on_bottom')
ADMIN2_THEME_DIRECTORY = getattr(settings, "ADMIN2_THEME_DIRECTORY", "djadmin2/bootstrap")

View file

@ -38,6 +38,18 @@
<div class="row-fluid">
<div class="span12">
<form method="post">
{% if view.model_admin.save_on_bottom %}
{# TODO - fix the format of the HTML #}
<hr />
{% if object %}
<a class="btn btn-small btn-danger" href="{% url view|admin2_urlname:'delete' pk=object.pk %}">{% trans "Delete" %}</a>
{% endif %}
{% include "djadmin2/bootstrap/includes/save_buttons.html" %}
<hr />
{% endif %}
{% csrf_token %}
{{ form.as_p }}
@ -71,12 +83,12 @@
</table>
{% endfor %}
<hr/>
{% if object %}
<a class="btn btn-small btn-danger" href="{% url view|admin2_urlname:'delete' pk=object.pk %}">{% trans "Delete" %}</a>
{% endif %}
{% if view.model_admin.actions_on_bottom %}
{% include "djadmin2/bootstrap/includes/action_buttons.html" %}
{% if view.model_admin.save_on_bottom %}
<hr/>
{% if object %}
<a class="btn btn-small btn-danger" href="{% url view|admin2_urlname:'delete' pk=object.pk %}">{% trans "Delete" %}</a>
{% endif %}
{% include "djadmin2/bootstrap/includes/save_buttons.html" %}
{% endif %}
</form>

View file

@ -50,7 +50,12 @@ class ModelAdmin2(object):
verbose_name = None
verbose_name_plural = None
model_admin_attributes = settings.MODEL_ADMIN_ATTRS
actions_on_bottom = True
save_on_top = False
save_on_bottom = True
# Not yet implemented. See #267 and #268
actions_on_bottom = False
actions_on_top = True
search_fields = []