diff --git a/cotisations/models.py b/cotisations/models.py index 6ea32e65..2828be38 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -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 diff --git a/cotisations/templates/cotisations/sidebar.html b/cotisations/templates/cotisations/sidebar.html index 8894fcbb..0b4c5c42 100644 --- a/cotisations/templates/cotisations/sidebar.html +++ b/cotisations/templates/cotisations/sidebar.html @@ -1,7 +1,5 @@ {% extends "base.html" %} {% block sidebar %} -

Créer une facture

-

Editer une facture

Liste des factures

{% endblock %} diff --git a/machines/templates/machines/aff_machines.html b/machines/templates/machines/aff_machines.html index 8840a7b7..612c1366 100644 --- a/machines/templates/machines/aff_machines.html +++ b/machines/templates/machines/aff_machines.html @@ -16,7 +16,7 @@ {{ machine.machine.type }} {{ machine.mac_address }} {{ machine.ipv4 }} - Editer + Editer {% endfor %} diff --git a/machines/templates/machines/sidebar.html b/machines/templates/machines/sidebar.html index a7464bb5..2d6342fc 100644 --- a/machines/templates/machines/sidebar.html +++ b/machines/templates/machines/sidebar.html @@ -1,5 +1,4 @@ {% extends "base.html" %} {% block sidebar %} -

Nouvelle machine

{% endblock %} diff --git a/users/templates/users/aff_users.html b/users/templates/users/aff_users.html index d9cfaab7..8ad206cc 100644 --- a/users/templates/users/aff_users.html +++ b/users/templates/users/aff_users.html @@ -21,12 +21,8 @@ Désactivée {% endif %} -
- {% csrf_token %} - - -
- + + {% endfor %} diff --git a/users/templates/users/index.html b/users/templates/users/index.html index 34a4f3d7..690399d2 100644 --- a/users/templates/users/index.html +++ b/users/templates/users/index.html @@ -4,6 +4,7 @@ {% block title %}Utilisateurs{% endblock %} {% block content %} +

Adhérents

{% include "users/aff_users.html" with users_list=users_list %}

diff --git a/users/templates/users/index_ban.html b/users/templates/users/index_ban.html new file mode 100644 index 00000000..86428706 --- /dev/null +++ b/users/templates/users/index_ban.html @@ -0,0 +1,13 @@ +{% extends "users/sidebar.html" %} +{% load bootstrap3 %} + +{% block title %}Utilisateurs{% endblock %} + +{% block content %} +

Bannissements

+ {% include "users/aff_bans.html" with ban_list=ban_list %} +
+
+
+{% endblock %} + diff --git a/users/templates/users/index_whitelist.html b/users/templates/users/index_whitelist.html new file mode 100644 index 00000000..009fb06f --- /dev/null +++ b/users/templates/users/index_whitelist.html @@ -0,0 +1,13 @@ +{% extends "users/sidebar.html" %} +{% load bootstrap3 %} + +{% block title %}Utilisateurs{% endblock %} + +{% block content %} +

Accès à titre gracieux

+ {% include "users/aff_whitelists.html" with white_list=white_list %} +
+
+
+{% endblock %} + diff --git a/users/templates/users/sidebar.html b/users/templates/users/sidebar.html index a976d4ac..1cc97e47 100644 --- a/users/templates/users/sidebar.html +++ b/users/templates/users/sidebar.html @@ -2,9 +2,8 @@ {% block sidebar %}

Créer un adhérent

-

Editer un adhérent

Liste des adhérents

-

Ajouter un bannissement

-

Gérer les bannissements

+

Liste des bannissements

+

Liste des accès à titre gracieux

Retirer un droit rezo

{% endblock %} diff --git a/users/urls.py b/users/urls.py index e4a92a27..a7d8b89a 100644 --- a/users/urls.py +++ b/users/urls.py @@ -13,7 +13,9 @@ urlpatterns = [ url(r'^edit_whitelist/(?P[0-9]+)$', views.edit_whitelist, name='edit-whitelist'), url(r'^add_right/(?P[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[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'), ] diff --git a/users/views.py b/users/views.py index c5d734cc..a4ae76c4 100644 --- a/users/views.py +++ b/users/views.py @@ -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})