1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-06-30 20:41:15 +02:00

Buttons in user admin

This commit is contained in:
Alexandre Iooss
2019-08-08 21:51:37 +02:00
parent 0c504e85fc
commit c225f5045e
6 changed files with 113 additions and 32 deletions

View File

@ -1,35 +0,0 @@
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% if users_list.paginator %}
{% include "pagination.html" with list=users_list %}
{% endif %}
<table class="table table-striped">
<thead>
<tr>
<th>Prénom</th>
<th>Nom</th>
<th>Pseudo</th>
<th>Mail</th>
<th>Max emprunts</th>
<th>Adhérent</th>
</tr>
</thead>
{% for user in users_list %}
<tr>
<td>{{ user.first_name }}</td>
<td>{{ user.last_name }}</td>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td>{{ user.maxemprunt }}</td>
{% if user.is_adherent %}
<td><span style="color:green">Oui</span></td>
{% else %}
<td><span style="color:red">Non</span></td>
{% endif %}
</tr>
{% endfor %}
</table>

View File

@ -1,21 +1,72 @@
{% extends "base.html" %}
{% extends "admin/base_site.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load bootstrap3 %}
{% load i18n static %}
{% block title %}Création et modification d'utilisateur{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'index' %}">{% trans 'Home' %}</a>
{% if title %} &rsaquo; {{ title }}{% endif %}
</div>
{% endblock %}
{% block extrahead %}{{ block.super }}
{# Load Django Admin widgets #}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
<script type="text/javascript" src="{% static 'admin/js/core.js' %}"></script>
{{ form.media }}
{% endblock %}
{% block extrastyle %}{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">
{% endblock %}
{% block content %}
{% bootstrap_form_errors userform %}
<form method="post" onsubmit="window.onbeforeunload=null">{% csrf_token %}
{% if form.non_field_errors %}
<p class="errornote">
{% for error in form.non_field_errors %}
{{ error }}
{% endfor %}
</p>
{% endif %}
<fieldset class="module aligned">
{% for field in form %}
<div class="form-row{% if field.errors %} errors{% endif %}">
{{ field.errors }}
<div>
{{ field.label_tag }}
{% if field.is_readonly %}
<div class="readonly">{{ field.contents }}</div>
{% else %}
{{ field }}
{% endif %}
{% if field.field.help_text %}
<div class="help">{{ field.field.help_text|safe }}</div>
{% endif %}
</div>
</div>
{% endfor %}
{% if password_change %}
<div class="form-row">
<div>
<label>Mot de passe</label>
<div class="readonly">
<a class="button" href="{% url 'users:password' %}">
Changer le mot de passe
</a>
</div>
</div>
</div>
{% endif %}
</fieldset>
<a href="{% url 'users:password' %}">
Changer le mot de passe
</a>
<form class="form" method="post">
{% csrf_token %}
{% bootstrap_form userform %}
{% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %}
<div class="submit-row">
<input class="default" type="submit" value="{% trans 'Create or edit' %}">
</div>
</form>
{% endblock %}