Commit a6261b82 authored by erdnaxe's avatar erdnaxe 🎇

PyCharm optimisation

parent 7e85d5e2
......@@ -3,6 +3,6 @@
{% block title %}Historique{% endblock %}
{% block content %}
<h2>Historique de {{ object }}</h2>
<h2>Historique de {{ object }}</h2>
{% include "med/aff_history.html" with reversions=reversions %}
{% endblock %}
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.utils.translation import gettext_lazy as _
from django.urls import include, path
from django.utils.translation import gettext_lazy as _
from .views import index
......
......@@ -10,7 +10,6 @@
{# CSS style #}
<link rel="stylesheet" href="{% static "/css/bootstrap.min.css" %}">
<link rel="stylesheet" href="{% static "/css/open-iconic-bootstrap.min.css" %}">
<link rel="stylesheet" href="{% static "/css/base.css" %}">
</head>
<body>
......
......@@ -21,12 +21,12 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from django.contrib import admin
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import Group
from reversion.admin import VersionAdmin
from .models import User, Right, Adhesion, ListRight, Clef, Request
from .forms import UserChangeForm, UserCreationForm
from .models import User, Right, Adhesion, ListRight, Clef, Request
class UserAdmin(admin.ModelAdmin):
......
......@@ -25,10 +25,12 @@
# Gplv2
from django.core.exceptions import PermissionDenied
import ipaddress
from django.shortcuts import redirect
from med.settings import AUTHORIZED_IP_RANGE, AUTHORIZED_IP6_RANGE
import ipaddress
def user_is_in_campus(function):
def wrap(request, *args, **kwargs):
......
......@@ -24,12 +24,12 @@
from django import forms
from django.forms import ModelForm, Form
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.core.validators import MinLengthValidator
from django.utils import timezone
from django.forms import ModelForm, Form
from .models import Adhesion, Clef, ListRight, Right, User
from .models import Adhesion, Clef, ListRight, Right, Request, User
class PassForm(forms.Form):
passwd1 = forms.CharField(label=u'Nouveau mot de passe', max_length=255, validators=[MinLengthValidator(8)], widget=forms.PasswordInput)
......
......@@ -160,7 +160,7 @@ class Request(models.Model):
created_at = models.DateTimeField(auto_now_add=True, editable=False)
expires_at = models.DateTimeField()
def save(self):
def save(self, **kwargs):
if not self.expires_at:
self.expires_at = timezone.now() \
+ datetime.timedelta(hours=REQ_EXPIRE_HRS)
......
......@@ -22,9 +22,9 @@
<td>{{ user.email }}</td>
<td>{{ user.maxemprunt }}</td>
{% if user.is_adherent %}
<td><font color="green">Oui</font></td>
<td><span class="badge badge-success">Oui</span></td>
{% else %}
<td><font color="red">Non</font></td>
<td><span class="badge badge-danger">Non</span></td>
{% endif %}
<td><a href="{% url "users:profil" user.id %}" class="btn btn-primary btn-sm" role="button"><i
class="glyphicon glyphicon-user"></i></a>
......
......@@ -70,11 +70,11 @@
<tr>
<th>Statut</th>
{% if user.state == 0 %}
<td><font color="green">Actif</font></td>
<td><span class="badge badge-success">Actif</span></td>
{% elif user.state == 1 %}
<td><font color="red">Désactivé</font></td>
<td><span class="badge badge-danger">Désactivé</span></td>
{% else %}
<td><font color="orange">Archivé</font></td>
<td><span class="badge badge-warning">Archivé</span></td>
{% endif %}
<th>Dernière connexion</th>
<td>{{ user.last_login }}</td>
......@@ -82,9 +82,9 @@
<tr>
<th>Adherent pour l'année en cours</th>
{% if user.is_adherent %}
<td><font color="green">Oui</font></td>
<td><span class="badge badge-success">Oui</span></td>
{% else %}
<td><font color="red">Non</font></td>
<td><span class="badge badge-danger">Non</span></td>
{% endif %}
{% if not user.is_adherent and is_bureau %}
<th></th>
......
......@@ -20,6 +20,4 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from django.test import TestCase
# Create your tests here.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment