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