mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Liste des bans et aatgs, +/- des liens, petit changement sur le fonctionnement du profil
This commit is contained in:
parent
39f89a21b6
commit
4f2236c9e0
11 changed files with 61 additions and 35 deletions
|
@ -68,7 +68,6 @@ class NewFactureForm(ModelForm):
|
|||
paiement = cleaned_data.get("paiement")
|
||||
cheque = cleaned_data.get("cheque")
|
||||
banque = cleaned_data.get("banque")
|
||||
print(paiement.moyen)
|
||||
if paiement.moyen=="chèque" and not (cheque and banque):
|
||||
raise forms.ValidationError("Le numero de chèque et la banque sont obligatoires")
|
||||
return cleaned_data
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block sidebar %}
|
||||
<p><a href="{% url "search:search" %}">Créer une facture</a></p>
|
||||
<p><a href="{% url "search:search" %}">Editer une facture</a></p>
|
||||
<p><a href="{% url "cotisations:index" %}">Liste des factures</a></p>
|
||||
{% endblock %}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<td>{{ machine.machine.type }}</td>
|
||||
<td>{{ machine.mac_address }}</td>
|
||||
<td>{{ machine.ipv4 }}</td>
|
||||
<td><a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:edit-machine' machine.id %}"><i class="glyphicon glyphicon-tree-conifer"></i> Editer</a></td>
|
||||
<td><a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:edit-machine' machine.id %}"><i class="glyphicon glyphicon-hdd"></i> Editer</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block sidebar %}
|
||||
<p><a href="{% url "search:search" %}">Nouvelle machine</a></p>
|
||||
{% endblock %}
|
||||
|
|
|
@ -21,12 +21,8 @@
|
|||
<font color="red">Désactivée</font>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><form method="POST" action="{% url "users:profil"%}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" id="user" value="{{ donnee.0.pseudo }}"></input>
|
||||
<button class="btn btn-primary btn-sm" type="submit"><i class="glyphicon glyphicon-tree-deciduous"></i></button>
|
||||
</form>
|
||||
</td>
|
||||
<td><a href="{% url "users:profil" donnee.0.id%}" class="btn btn-primary btn-sm" role="button"><i class="glyphicon glyphicon-user"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
{% block title %}Utilisateurs{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Adhérents</h2>
|
||||
{% include "users/aff_users.html" with users_list=users_list %}
|
||||
<br />
|
||||
<br />
|
||||
|
|
13
users/templates/users/index_ban.html
Normal file
13
users/templates/users/index_ban.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% extends "users/sidebar.html" %}
|
||||
{% load bootstrap3 %}
|
||||
|
||||
{% block title %}Utilisateurs{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Bannissements</h2>
|
||||
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
{% endblock %}
|
||||
|
13
users/templates/users/index_whitelist.html
Normal file
13
users/templates/users/index_whitelist.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% extends "users/sidebar.html" %}
|
||||
{% load bootstrap3 %}
|
||||
|
||||
{% block title %}Utilisateurs{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Accès à titre gracieux</h2>
|
||||
{% include "users/aff_whitelists.html" with white_list=white_list %}
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
{% endblock %}
|
||||
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
{% block sidebar %}
|
||||
<p><a href="{% url "users:new-user" %}">Créer un adhérent</a></p>
|
||||
<p><a href="{% url "search:search" %}">Editer un adhérent</a></p>
|
||||
<p><a href="{% url "users:index" %}">Liste des adhérents</a></p>
|
||||
<p><a href="{% url "search:search" %}">Ajouter un bannissement</a></p>
|
||||
<p><a href="{% url "search:search" %}">Gérer les bannissements</a></p>
|
||||
<p><a href="{% url "users:index-ban" %}">Liste des bannissements</a></p>
|
||||
<p><a href="{% url "users:index-white" %}">Liste des accès à titre gracieux</a></p>
|
||||
<p><a href="{% url "users:del-right" %}">Retirer un droit rezo</a></p>
|
||||
{% endblock %}
|
||||
|
|
|
@ -13,7 +13,9 @@ urlpatterns = [
|
|||
url(r'^edit_whitelist/(?P<whitelistid>[0-9]+)$', views.edit_whitelist, name='edit-whitelist'),
|
||||
url(r'^add_right/(?P<userid>[0-9]+)$', views.add_right, name='add-right'),
|
||||
url(r'^del_right/$', views.del_right, name='del-right'),
|
||||
url(r'^profil/$', views.profil, name='profil'),
|
||||
url(r'^profil/(?P<userid>[0-9]+)$', views.profil, name='profil'),
|
||||
url(r'^index_ban/$', views.index_ban, name='index-ban'),
|
||||
url(r'^index_white/$', views.index_white, name='index-white'),
|
||||
url(r'^$', views.index, name='index'),
|
||||
]
|
||||
|
||||
|
|
|
@ -224,24 +224,30 @@ def index(request):
|
|||
connexion.append([user, has_access(user)])
|
||||
return render(request, 'users/index.html', {'users_list': connexion})
|
||||
|
||||
def profil(request):
|
||||
if request.method == 'POST':
|
||||
profil = ProfilForm(request.POST or None)
|
||||
if profil.is_valid():
|
||||
profils = profil.cleaned_data['user']
|
||||
users = User.objects.get(pseudo = profils)
|
||||
machines = Interface.objects.filter(machine=Machine.objects.filter(user__pseudo = users))
|
||||
factures = Facture.objects.filter(user__pseudo = users)
|
||||
bans = Ban.objects.filter(user__pseudo = users)
|
||||
whitelists = Whitelist.objects.filter(user__pseudo = users)
|
||||
end_bans = None
|
||||
end_whitelists = None
|
||||
if(is_ban(users)):
|
||||
end_bans=end_ban(users)
|
||||
if(is_whitelisted(users)):
|
||||
end_whitelists=end_whitelist(users)
|
||||
list_droits = Right.objects.filter(user=users)
|
||||
return render(request, 'users/profil.html', {'user': users, 'machine_list' :machines, 'facture_list':factures, 'ban_list':bans, 'white_list':whitelists,'end_ban':end_bans,'end_whitelist':end_whitelists, 'end_adhesion':end_adhesion(users), 'actif':has_access(users), 'list_droits': list_droits})
|
||||
return redirect("/users/")
|
||||
return redirect("/users/")
|
||||
def index_ban(request):
|
||||
ban_list = Ban.objects.order_by('date_start')
|
||||
return render(request, 'users/index_ban.html', {'ban_list':ban_list})
|
||||
|
||||
def index_white(request):
|
||||
white_list = Whitelist.objects.order_by('date_start')
|
||||
return render(request, 'users/index_whitelist.html', {'white_list':white_list})
|
||||
|
||||
def profil(request, userid):
|
||||
try:
|
||||
users = User.objects.get(pk=userid)
|
||||
except User.DoesNotExist:
|
||||
messages.error(request, u"Utilisateur inexistant" )
|
||||
return redirect("/users/")
|
||||
machines = Interface.objects.filter(machine=Machine.objects.filter(user__pseudo = users))
|
||||
factures = Facture.objects.filter(user__pseudo = users)
|
||||
bans = Ban.objects.filter(user__pseudo = users)
|
||||
whitelists = Whitelist.objects.filter(user__pseudo = users)
|
||||
end_bans = None
|
||||
end_whitelists = None
|
||||
if(is_ban(users)):
|
||||
end_bans=end_ban(users)
|
||||
if(is_whitelisted(users)):
|
||||
end_whitelists=end_whitelist(users)
|
||||
list_droits = Right.objects.filter(user=users)
|
||||
return render(request, 'users/profil.html', {'user': users, 'machine_list' :machines, 'facture_list':factures, 'ban_list':bans, 'white_list':whitelists,'end_ban':end_bans,'end_whitelist':end_whitelists, 'end_adhesion':end_adhesion(users), 'actif':has_access(users), 'list_droits': list_droits})
|
||||
|
||||
|
|
Loading…
Reference in a new issue