8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 20:33:11 +00:00

Overwrite admin templates (2)

This commit is contained in:
Alexandre Iooss 2019-02-17 18:43:40 +01:00 committed by Alexandre IOOSS
parent cf586ff52e
commit 9879f940a3
3 changed files with 159 additions and 0 deletions

View file

@ -0,0 +1,53 @@
{# Please keep this template in sync with django/contrib/admin one #}
{% extends "admin/base_site.html" %}
{% load i18n admin_urls static %}
{% block extrahead %}
{{ block.super }}
{{ media }}
<script type="text/javascript" src="{% static 'admin/js/cancel.js' %}"></script>
{% endblock %}
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %}
{% block breadcrumbs %}
<ol class="breadcrumb"><li class="home">
<a href="{% url '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><a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst|escape }}</a>
</li><li><a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}">{{ object|truncatewords:"18" }}</a>
</li><li class="active">{% trans 'Delete' %}
</li></ol>
{% endblock %}
{% block content %}
{% if perms_lacking %}
<p>{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p>
<ul>
{% for obj in perms_lacking %}
<li>{{ obj }}</li>
{% endfor %}
</ul>
{% elif protected %}
<p>{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktrans %}</p>
<ul>
{% for obj in protected %}
<li>{{ obj }}</li>
{% endfor %}
</ul>
{% else %}
<p>{% blocktrans with escaped_object=object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktrans %}</p>
{% include "admin/includes/object_delete_summary.html" %}
<h2>{% trans "Objects" %}</h2>
<ul>{{ deleted_objects|unordered_list }}</ul>
<form method="post">{% csrf_token %}
<div>
<input type="hidden" name="post" value="yes" />
{% 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 %}
<input type="submit" class="btn btn-danger" value="{% trans "Yes, I'm sure" %}" />
<a href="#" class="button cancel-link">{% trans "No, take me back" %}</a>
</div>
</form>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,43 @@
{# Please keep this template in sync with django/contrib/admin one #}
{% extends "admin/base_site.html" %}
{% load i18n admin_urls %}
{% block breadcrumbs %}
<ol class="breadcrumb"><li class="home">
<a href="{% url '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><a href="{% url opts|admin_urlname:'changelist' %}">{{ module_name }}</a>
</li><li><a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}">{{ object|truncatewords:"18" }}</a>
</li><li class="active">{% trans 'History' %}
</li></ol>
{% endblock %}
{% block content %}
<div id="content-main">
<div class="module">
{% if action_list %}
<table id="change-history" class="table table-striped table-bordered">
<thead>
<tr>
<th scope="col">{% trans 'Date/time' %}</th>
<th scope="col">{% trans 'User' %}</th>
<th scope="col">{% trans 'Action' %}</th>
</tr>
</thead>
<tbody>
{% for action in action_list %}
<tr>
<th scope="row">{{ action.action_time|date:"DATETIME_FORMAT" }}</th>
<td>{{ action.user.get_username }}{% if action.user.get_full_name %} ({{ action.user.get_full_name }}){% endif %}</td>
<td>{{ action.get_change_message }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "This object doesn't have a change history. It probably wasn't added via this admin site." %}</p>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,63 @@
{% 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 %}
{% 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>