8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-28 15:42:25 +00:00

Sync admin template with Django contrib code

This commit is contained in:
Alexandre Iooss 2019-02-17 18:16:42 +01:00 committed by Alexandre IOOSS
parent 69ff7a2391
commit cf586ff52e
3 changed files with 62 additions and 102 deletions

View file

@ -1,38 +1,19 @@
{% extends "admin/base_site.html" %} {# Please keep this template in sync with django/contrib/admin one #}
{% extends "admin/index.html" %}
{% load i18n %} {% load i18n %}
{% block breadcrumbs %} {% block bodyclass %}{{ block.super }} app-{{ app_label }}{% endblock %}
<ol class="breadcrumb">
<li class="home">
<a href="{% url 'index' %}" title="{% trans 'Home' %}">
<span class="glyphicon glyphicon-home"></span>
</a>
</li>
<li class="active">{% for app in app_list %}{{ app.name }}{% endfor %}</li>
</ol>
{% endblock %}
{% block content %} {% if not is_popup %}
{% if app_list %} {% block breadcrumbs %}
<div class="panel panel-default"> <ol class="breadcrumb"><li class="home">
<div class="panel-heading"> <a href="{% url 'index' %}">{% trans 'Home' %}</a>
<h3 class="panel-title">{% trans "Models" %}</h3> </li><li class="active">
</div> {% for app in app_list %}
<div class="panel-body"> {{ app.name }}
<ul> {% endfor %}
{% for app in app_list %} </li></ol>
{% for model in app.models %}
<li class="model-name model-{{ model.object_name|lower }}">
<a href="{% if model.admin_url %}{{ model.admin_url }}{% else %}#{% endif %}"
{% if not model.admin_url %}class="disabled"{% endif %}>{{ model.name }}</a>
</li>
{% endfor %}
{% endfor %}
</ul>
</div>
</div>
{% else %}
<p>{% trans "You don't have permission to edit anything." %}</p>
{% endif %}
{% endblock %} {% endblock %}
{% endif %}
{% block sidebar %}{% endblock %}

View file

@ -1,7 +1,10 @@
{# Please keep this template in sync with django/contrib/admin one #}
{% extends "users/sidebar.html" %} {% extends "users/sidebar.html" %}
{% load static %}
{% block title %}{{ title }}{% endblock %} {% block title %}{{ title }}{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('Django administration') }}</a></h1>
{% endblock %}
{% block nav-global %}{% endblock %} {% block nav-global %}{% endblock %}

View file

@ -1,80 +1,56 @@
{# Please keep this template in sync with django/contrib/admin one #}
{% extends "admin/base_site.html" %} {% extends "admin/base_site.html" %}
{% load i18n l10n admin_urls static %} {% load i18n l10n admin_urls static %}
{% block extrahead %} {% block extrahead %}
{{ block.super }} {{ block.super }}
{{ media }} {{ media }}
{# Make previous link works #}
<script type="text/javascript" src="{% static 'admin/js/cancel.js' %}"></script> <script type="text/javascript" src="{% static 'admin/js/cancel.js' %}"></script>
{% endblock %} {% endblock %}
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<ol class="breadcrumb"> <ol class="breadcrumb"><li class="home">
<li class="home"> <a href="{% url 'index' %}">{% trans 'Home' %}</a>
<a href="{% url 'index' %}" title="{% trans 'Home' %}"><span class="glyphicon glyphicon-home"></span></a> </li><li><a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
</li> </li><li><a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst|escape }}</a>
<li> </li><li class="active">{% trans 'Delete multiple objects' %}
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a> </li></ol>
</li>
<li>
<a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst|escape }}</a>
</li>
<li class="active">{% trans 'Delete multiple objects' %}</li>
</ol>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if perms_lacking or protected %} {% if perms_lacking %}
{% if perms_lacking %} <p>{% blocktrans %}Deleting the selected {{ objects_name }} would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p>
<div class="panel panel-default"> <ul>
<div class="panel-heading"> {% for obj in perms_lacking %}
{% blocktrans %}Deleting the selected {{ objects_name }} would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %} <li>{{ obj }}</li>
</div> {% endfor %}
<div class="panel-body"> </ul>
<ul> {% elif protected %}
{% for obj in perms_lacking %} <p>{% blocktrans %}Deleting the selected {{ objects_name }} would require deleting the following protected related objects:{% endblocktrans %}</p>
<li>{{ obj }}</li> <ul>
{% endfor %} {% for obj in protected %}
</ul> <li>{{ obj }}</li>
</div> {% endfor %}
</div> </ul>
{% endif %} {% else %}
{% if protected %} <p>{% blocktrans %}Are you sure you want to delete the selected {{ objects_name }}? All of the following objects and their related items will be deleted:{% endblocktrans %}</p>
<div class="panel panel-default"> {% include "admin/includes/object_delete_summary.html" %}
<div class="panel-heading"> <h2>{% trans "Objects" %}</h2>
{% blocktrans %}Deleting the selected {{ objects_name }} would require deleting the following protected related objects:{% endblocktrans %} {% for deletable_object in deletable_objects %}
</div> <ul>{{ deletable_object|unordered_list }}</ul>
<div class="panel-body"> {% endfor %}
<ul> <form method="post">{% csrf_token %}
{% for obj in protected %} <div>
<li>{{ obj }}</li> {% for obj in queryset %}
{% endfor %} <input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}" />
</ul> {% endfor %}
</div> <input type="hidden" name="action" value="delete_selected" />
</div> <input type="hidden" name="post" value="yes" />
{% endif %} <input type="submit" class="btn btn-danger" value="{% trans "Yes, I'm sure" %}" />
{% else %} <a href="#" class="button cancel-link">{% trans "No, take me back" %}</a>
<div class="panel panel-default"> </div>
<div class="panel-heading"> </form>
{% blocktrans %}Are you sure you want to delete the selected {{ objects_name }}? All of the following objects and their related items will be deleted:{% endblocktrans %} {% endif %}
</div>
<div class="panel-body">
{% for deletable_object in deletable_objects %}
<ul>{{ deletable_object|unordered_list }}</ul>
{% endfor %}
<hr>
<form action="" method="post">{% csrf_token %}
<div>
{% for obj in queryset %}
<input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}"/>
{% endfor %}
<input type="hidden" name="action" value="delete_selected"/>
<input type="hidden" name="post" value="yes"/>
<input type="submit" class="btn btn-danger" value="{% trans "Yes, I'm sure" %}"/>
</div>
</form>
</div>
</div>
{% endif %}
{% endblock %} {% endblock %}