mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-24 20:33:11 +00:00
Overwrite admin templates (5)
This commit is contained in:
parent
231497d16b
commit
13865d697c
4 changed files with 160 additions and 61 deletions
86
templates/admin/change_form.html
Normal file
86
templates/admin/change_form.html
Normal file
|
@ -0,0 +1,86 @@
|
|||
{# Please keep this template in sync with django/contrib/admin one #}
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n admin_urls static admin_modify %}
|
||||
|
||||
{% block extrahead %}{{ block.super }}
|
||||
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
|
||||
{{ media }}
|
||||
{% endblock %}
|
||||
|
||||
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}
|
||||
|
||||
{% block coltype %}colM{% endblock %}
|
||||
|
||||
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %}
|
||||
|
||||
{% if not is_popup %}
|
||||
{% block breadcrumbs %}
|
||||
<ol class="breadcrumb"><li class="home">
|
||||
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
|
||||
</li><li><a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
|
||||
</li><li>{% if has_change_permission %}<a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %}
|
||||
</li><li class="active">{% if add %}{% blocktrans with name=opts.verbose_name %}Add {{ name }}{% endblocktrans %}{% else %}{{ original|truncatewords:"18" }}{% endif %}
|
||||
</li></ol>
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
||||
{% block content %}<div id="content-main">
|
||||
{% block object-tools %}
|
||||
{% if change %}{% if not is_popup %}
|
||||
<ul class="object-tools list-inline">
|
||||
{% block object-tools-items %}
|
||||
<li class="btn-group">
|
||||
{% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
|
||||
<a href="{% add_preserved_filters history_url %}" class="historylink btn btn-default"><span class="glyphicon glyphicon-list-alt"></span> {% trans "History" %}</a>
|
||||
</li>
|
||||
{% if has_absolute_url %}<li class="btn-group"><a href="{{ absolute_url }}" class="viewsitelink btn btn-default"><span class="glyphicon glyphicon-new-window"></span> {% trans "View on site" %}</a></li>{% endif %}
|
||||
{% endblock %}
|
||||
</ul>
|
||||
{% endif %}{% endif %}
|
||||
{% endblock %}
|
||||
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
|
||||
<div>
|
||||
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1" />{% endif %}
|
||||
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}" />{% endif %}
|
||||
{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %}
|
||||
{% if errors %}
|
||||
<p class="errornote">
|
||||
{% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
|
||||
</p>
|
||||
{{ adminform.form.non_field_errors }}
|
||||
{% endif %}
|
||||
|
||||
{% block field_sets %}
|
||||
{% for fieldset in adminform %}
|
||||
{% include "admin/includes/fieldset.html" %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block after_field_sets %}{% endblock %}
|
||||
|
||||
{% block inline_field_sets %}
|
||||
{% for inline_admin_formset in inline_admin_formsets %}
|
||||
{% include inline_admin_formset.opts.template %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block after_related_objects %}{% endblock %}
|
||||
|
||||
{% block submit_buttons_bottom %}{% submit_row %}{% endblock %}
|
||||
|
||||
{% block admin_change_form_document_ready %}
|
||||
<script type="text/javascript"
|
||||
id="django-admin-form-add-constants"
|
||||
src="{% static 'admin/js/change_form.js' %}"
|
||||
{% if adminform and add %}
|
||||
data-model-name="{{ opts.model_name }}"
|
||||
{% endif %}>
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{# JavaScript for prepopulated fields #}
|
||||
{% prepopulated_fields_js %}
|
||||
|
||||
</div>
|
||||
</form></div>
|
||||
{% endblock %}
|
27
templates/admin/includes/fieldset.html
Normal file
27
templates/admin/includes/fieldset.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{# Please keep this template in sync with django/contrib/admin one #}
|
||||
{% load bootstrap3 %}
|
||||
<fieldset class="module aligned {{ fieldset.classes }}">
|
||||
{% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
|
||||
{% if fieldset.description %}
|
||||
<div class="description">{{ fieldset.description|safe }}</div>
|
||||
{% endif %}
|
||||
{% for line in fieldset %}
|
||||
<div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% if not line.has_visible_field %} hidden{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
|
||||
{% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
|
||||
{% for field in line %}
|
||||
<div{% if not line.fields|length_is:'1' %} class="field-box{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
|
||||
{% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
|
||||
{% if field.is_checkbox %}
|
||||
{{ field.field }}{{ field.label_tag }}
|
||||
{% if field.field.help_text %}
|
||||
<div class="help">{{ field.field.help_text|safe }}</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ field.label_tag }}
|
||||
{% bootstrap_field field.field show_label=False %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</fieldset>
|
|
@ -1,63 +1,38 @@
|
|||
{% comment %}
|
||||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
|
||||
se veut agnostique au réseau considéré, de manière à être installable en
|
||||
quelques clics.
|
||||
|
||||
Copyright © 2019 Alexandre Iooss
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
|
||||
{# Please keep this template in sync with django/contrib/admin one #}
|
||||
{% load i18n admin_urls %}
|
||||
<div class="btn-group-vertical">
|
||||
{% if show_save %}
|
||||
<button type="submit" title="{% trans 'Save' %}" class="btn btn-success" name="_save">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
<span class="text">{% trans 'Save' %}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
{% if show_delete_link %}
|
||||
{% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %}
|
||||
<a title="{% trans "Delete" %}" class="btn btn-danger"
|
||||
href="{% add_preserved_filters delete_url %}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
<span class="text">{% trans "Delete" %}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if show_save_as_new %}
|
||||
<button type="submit" class="btn btn-success" title="{% trans 'Save as new' %}" name="_saveasnew">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="text">{% trans 'Save as new' %}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
{% if show_save_and_add_another %}
|
||||
<button type="submit" class="btn btn-default" title="{% trans 'Save and add another' %}" name="_addanother"
|
||||
style="white-space:normal !important; word-wrap: break-word;">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="text">{% trans 'Save and add another' %}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
{% if show_save_and_continue %}
|
||||
<button type="submit" class="btn btn-default" title="{% trans 'Save and continue editing' %}" name="_continue"
|
||||
style="white-space:normal !important; word-wrap: break-word;">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
<span class="text">{% trans 'Save and continue editing' %}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
<div class="submit-row">
|
||||
{% if show_save %}
|
||||
<button type="submit" title="{% trans 'Save' %}" class="btn btn-success" name="_save">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
<span class="text">{% trans 'Save' %}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if show_delete_link %}
|
||||
{% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %}
|
||||
<a title="{% trans "Delete" %}" class="btn btn-danger"
|
||||
href="{% add_preserved_filters delete_url %}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
<span class="text">{% trans "Delete" %}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if show_save_as_new %}
|
||||
<button type="submit" class="btn btn-success" title="{% trans 'Save as new' %}" name="_saveasnew">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="text">{% trans 'Save as new' %}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if show_save_and_add_another %}
|
||||
<button type="submit" class="btn btn-default" title="{% trans 'Save and add another' %}" name="_addanother"
|
||||
style="white-space:normal !important; word-wrap: break-word;">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="text">{% trans 'Save and add another' %}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if show_save_and_continue %}
|
||||
<button type="submit" class="btn btn-default" title="{% trans 'Save and continue editing' %}" name="_continue"
|
||||
style="white-space:normal !important; word-wrap: break-word;">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
<span class="text">{% trans 'Save and continue editing' %}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
11
templates/reversion/change_list.html
Normal file
11
templates/reversion/change_list.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
{# Please keep this template in sync with reversion one #}
|
||||
{% extends "admin/change_list.html" %}
|
||||
{% load i18n admin_urls %}
|
||||
|
||||
|
||||
{% block object-tools-items %}
|
||||
{% if not is_popup and has_add_permission and has_change_permission %}
|
||||
<li><a href="{% url opts|admin_urlname:'recoverlist' %}" class="recoverlink btn btn-default btn-sm"><span class="glyphicon glyphicon-repeat"></span> {% blocktrans with cl.opts.verbose_name_plural|escape as name %}Recover deleted {{name}}{% endblocktrans %}</a></li>
|
||||
{% endif %}
|
||||
{{block.super}}
|
||||
{% endblock %}
|
Loading…
Reference in a new issue