mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-26 14:42:25 +00:00
Login_required
This commit is contained in:
parent
472d5e4b90
commit
d445790dd4
6 changed files with 59 additions and 18 deletions
|
@ -5,6 +5,7 @@ from django.shortcuts import render, redirect
|
||||||
from django.shortcuts import render_to_response, get_object_or_404
|
from django.shortcuts import render_to_response, get_object_or_404
|
||||||
from django.core.context_processors import csrf
|
from django.core.context_processors import csrf
|
||||||
from django.template import Context, RequestContext, loader
|
from django.template import Context, RequestContext, loader
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.db.models import Max, ProtectedError
|
from django.db.models import Max, ProtectedError
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ def create_cotis(facture, user, duration):
|
||||||
cotisation.save()
|
cotisation.save()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@login_required
|
||||||
def new_facture(request, userid):
|
def new_facture(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -70,9 +72,11 @@ def new_facture(request, userid):
|
||||||
return redirect("/users/profil/" + userid)
|
return redirect("/users/profil/" + userid)
|
||||||
return form({'factureform': facture_form}, 'cotisations/facture.html', request)
|
return form({'factureform': facture_form}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def new_facture_pdf(request):
|
def new_facture_pdf(request):
|
||||||
return render_tex(request, 'cotisations/factures.tex', {'DATE':None})
|
return render_tex(request, 'cotisations/factures.tex', {'DATE':None})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_facture(request, factureid):
|
def edit_facture(request, factureid):
|
||||||
try:
|
try:
|
||||||
facture = Facture.objects.get(pk=factureid)
|
facture = Facture.objects.get(pk=factureid)
|
||||||
|
@ -86,6 +90,7 @@ def edit_facture(request, factureid):
|
||||||
return redirect("/cotisations/")
|
return redirect("/cotisations/")
|
||||||
return form({'factureform': facture_form}, 'cotisations/facture.html', request)
|
return form({'factureform': facture_form}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def add_article(request):
|
def add_article(request):
|
||||||
article = ArticleForm(request.POST or None)
|
article = ArticleForm(request.POST or None)
|
||||||
if article.is_valid():
|
if article.is_valid():
|
||||||
|
@ -94,6 +99,7 @@ def add_article(request):
|
||||||
return redirect("/cotisations/index_article/")
|
return redirect("/cotisations/index_article/")
|
||||||
return form({'factureform': article}, 'cotisations/facture.html', request)
|
return form({'factureform': article}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_article(request, articleid):
|
def edit_article(request, articleid):
|
||||||
try:
|
try:
|
||||||
article_instance = Article.objects.get(pk=articleid)
|
article_instance = Article.objects.get(pk=articleid)
|
||||||
|
@ -107,6 +113,7 @@ def edit_article(request, articleid):
|
||||||
return redirect("/cotisations/index_article/")
|
return redirect("/cotisations/index_article/")
|
||||||
return form({'factureform': article}, 'cotisations/facture.html', request)
|
return form({'factureform': article}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def del_article(request):
|
def del_article(request):
|
||||||
article = DelArticleForm(request.POST or None)
|
article = DelArticleForm(request.POST or None)
|
||||||
if article.is_valid():
|
if article.is_valid():
|
||||||
|
@ -116,6 +123,7 @@ def del_article(request):
|
||||||
return redirect("/cotisations/index_article")
|
return redirect("/cotisations/index_article")
|
||||||
return form({'factureform': article}, 'cotisations/facture.html', request)
|
return form({'factureform': article}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def add_paiement(request):
|
def add_paiement(request):
|
||||||
paiement = PaiementForm(request.POST or None)
|
paiement = PaiementForm(request.POST or None)
|
||||||
if paiement.is_valid():
|
if paiement.is_valid():
|
||||||
|
@ -124,6 +132,7 @@ def add_paiement(request):
|
||||||
return redirect("/cotisations/index_paiement/")
|
return redirect("/cotisations/index_paiement/")
|
||||||
return form({'factureform': paiement}, 'cotisations/facture.html', request)
|
return form({'factureform': paiement}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_paiement(request, paiementid):
|
def edit_paiement(request, paiementid):
|
||||||
try:
|
try:
|
||||||
paiement_instance = Paiement.objects.get(pk=paiementid)
|
paiement_instance = Paiement.objects.get(pk=paiementid)
|
||||||
|
@ -137,6 +146,7 @@ def edit_paiement(request, paiementid):
|
||||||
return redirect("/cotisations/index_paiement/")
|
return redirect("/cotisations/index_paiement/")
|
||||||
return form({'factureform': paiement}, 'cotisations/facture.html', request)
|
return form({'factureform': paiement}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def del_paiement(request):
|
def del_paiement(request):
|
||||||
paiement = DelPaiementForm(request.POST or None)
|
paiement = DelPaiementForm(request.POST or None)
|
||||||
if paiement.is_valid():
|
if paiement.is_valid():
|
||||||
|
@ -150,6 +160,7 @@ def del_paiement(request):
|
||||||
return redirect("/cotisations/index_paiement/")
|
return redirect("/cotisations/index_paiement/")
|
||||||
return form({'factureform': paiement}, 'cotisations/facture.html', request)
|
return form({'factureform': paiement}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def add_banque(request):
|
def add_banque(request):
|
||||||
banque = BanqueForm(request.POST or None)
|
banque = BanqueForm(request.POST or None)
|
||||||
if banque.is_valid():
|
if banque.is_valid():
|
||||||
|
@ -158,6 +169,7 @@ def add_banque(request):
|
||||||
return redirect("/cotisations/index_banque/")
|
return redirect("/cotisations/index_banque/")
|
||||||
return form({'factureform': banque}, 'cotisations/facture.html', request)
|
return form({'factureform': banque}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_banque(request, banqueid):
|
def edit_banque(request, banqueid):
|
||||||
try:
|
try:
|
||||||
banque_instance = Article.objects.get(pk=banqueid)
|
banque_instance = Article.objects.get(pk=banqueid)
|
||||||
|
@ -171,6 +183,7 @@ def edit_banque(request, banqueid):
|
||||||
return redirect("/cotisations/index_banque/")
|
return redirect("/cotisations/index_banque/")
|
||||||
return form({'factureform': banque}, 'cotisations/facture.html', request)
|
return form({'factureform': banque}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def del_banque(request):
|
def del_banque(request):
|
||||||
banque = DelBanqueForm(request.POST or None)
|
banque = DelBanqueForm(request.POST or None)
|
||||||
if banque.is_valid():
|
if banque.is_valid():
|
||||||
|
@ -184,18 +197,22 @@ def del_banque(request):
|
||||||
return redirect("/cotisations/index_banque/")
|
return redirect("/cotisations/index_banque/")
|
||||||
return form({'factureform': banque}, 'cotisations/facture.html', request)
|
return form({'factureform': banque}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index_article(request):
|
def index_article(request):
|
||||||
article_list = Article.objects.order_by('name')
|
article_list = Article.objects.order_by('name')
|
||||||
return render(request, 'cotisations/index_article.html', {'article_list':article_list})
|
return render(request, 'cotisations/index_article.html', {'article_list':article_list})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index_paiement(request):
|
def index_paiement(request):
|
||||||
paiement_list = Paiement.objects.order_by('moyen')
|
paiement_list = Paiement.objects.order_by('moyen')
|
||||||
return render(request, 'cotisations/index_paiement.html', {'paiement_list':paiement_list})
|
return render(request, 'cotisations/index_paiement.html', {'paiement_list':paiement_list})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index_banque(request):
|
def index_banque(request):
|
||||||
banque_list = Banque.objects.order_by('name')
|
banque_list = Banque.objects.order_by('name')
|
||||||
return render(request, 'cotisations/index_banque.html', {'banque_list':banque_list})
|
return render(request, 'cotisations/index_banque.html', {'banque_list':banque_list})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index(request):
|
def index(request):
|
||||||
facture_list = Facture.objects.order_by('date').reverse()
|
facture_list = Facture.objects.order_by('date').reverse()
|
||||||
return render(request, 'cotisations/index.html', {'facture_list': facture_list})
|
return render(request, 'cotisations/index.html', {'facture_list': facture_list})
|
||||||
|
|
|
@ -6,6 +6,7 @@ from django.shortcuts import render_to_response, get_object_or_404
|
||||||
from django.core.context_processors import csrf
|
from django.core.context_processors import csrf
|
||||||
from django.template import Context, RequestContext, loader
|
from django.template import Context, RequestContext, loader
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import ProtectedError
|
from django.db.models import ProtectedError
|
||||||
|
|
||||||
from .forms import NewMachineForm, EditMachineForm, EditInterfaceForm, AddInterfaceForm, NewInterfaceForm, MachineTypeForm, DelMachineTypeForm
|
from .forms import NewMachineForm, EditMachineForm, EditInterfaceForm, AddInterfaceForm, NewInterfaceForm, MachineTypeForm, DelMachineTypeForm
|
||||||
|
@ -47,6 +48,7 @@ def form(ctx, template, request):
|
||||||
c.update(csrf(request))
|
c.update(csrf(request))
|
||||||
return render_to_response(template, c, context_instance=RequestContext(request))
|
return render_to_response(template, c, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
@login_required
|
||||||
def new_machine(request, userid):
|
def new_machine(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -70,6 +72,7 @@ def new_machine(request, userid):
|
||||||
return redirect("/users/profil/" + userid)
|
return redirect("/users/profil/" + userid)
|
||||||
return form({'machineform': machine, 'interfaceform': interface}, 'machines/machine.html', request)
|
return form({'machineform': machine, 'interfaceform': interface}, 'machines/machine.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_machine(request, interfaceid):
|
def edit_machine(request, interfaceid):
|
||||||
try:
|
try:
|
||||||
interface = Interface.objects.get(pk=interfaceid)
|
interface = Interface.objects.get(pk=interfaceid)
|
||||||
|
@ -85,6 +88,7 @@ def edit_machine(request, interfaceid):
|
||||||
return redirect("/machines/")
|
return redirect("/machines/")
|
||||||
return form({'machineform': machine_form, 'interfaceform': interface_form}, 'machines/machine.html', request)
|
return form({'machineform': machine_form, 'interfaceform': interface_form}, 'machines/machine.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def new_interface(request, machineid):
|
def new_interface(request, machineid):
|
||||||
try:
|
try:
|
||||||
machine = Machine.objects.get(pk=machineid)
|
machine = Machine.objects.get(pk=machineid)
|
||||||
|
@ -106,6 +110,7 @@ def new_interface(request, machineid):
|
||||||
return redirect("/machines/")
|
return redirect("/machines/")
|
||||||
return form({'machineform': machine_form, 'interfaceform': interface_form}, 'machines/machine.html', request)
|
return form({'machineform': machine_form, 'interfaceform': interface_form}, 'machines/machine.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def add_machinetype(request):
|
def add_machinetype(request):
|
||||||
machinetype = MachineTypeForm(request.POST or None)
|
machinetype = MachineTypeForm(request.POST or None)
|
||||||
if machinetype.is_valid():
|
if machinetype.is_valid():
|
||||||
|
@ -114,6 +119,7 @@ def add_machinetype(request):
|
||||||
return redirect("/machines/index_machinetype")
|
return redirect("/machines/index_machinetype")
|
||||||
return form({'machineform': machinetype, 'interfaceform': None}, 'machines/machine.html', request)
|
return form({'machineform': machinetype, 'interfaceform': None}, 'machines/machine.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_machinetype(request, machinetypeid):
|
def edit_machinetype(request, machinetypeid):
|
||||||
try:
|
try:
|
||||||
machinetype_instance = MachineType.objects.get(pk=machinetypeid)
|
machinetype_instance = MachineType.objects.get(pk=machinetypeid)
|
||||||
|
@ -127,6 +133,7 @@ def edit_machinetype(request, machinetypeid):
|
||||||
return redirect("/machines/index_machinetype/")
|
return redirect("/machines/index_machinetype/")
|
||||||
return form({'machineform': machinetype}, 'machines/machine.html', request)
|
return form({'machineform': machinetype}, 'machines/machine.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def del_machinetype(request):
|
def del_machinetype(request):
|
||||||
machinetype = DelMachineTypeForm(request.POST or None)
|
machinetype = DelMachineTypeForm(request.POST or None)
|
||||||
if machinetype.is_valid():
|
if machinetype.is_valid():
|
||||||
|
@ -140,10 +147,12 @@ def del_machinetype(request):
|
||||||
return redirect("/machines/index_machinetype")
|
return redirect("/machines/index_machinetype")
|
||||||
return form({'machineform': machinetype, 'interfaceform': None}, 'machines/machine.html', request)
|
return form({'machineform': machinetype, 'interfaceform': None}, 'machines/machine.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index(request):
|
def index(request):
|
||||||
interfaces_list = Interface.objects.order_by('pk')
|
interfaces_list = Interface.objects.order_by('pk')
|
||||||
return render(request, 'machines/index.html', {'interfaces_list': interfaces_list})
|
return render(request, 'machines/index.html', {'interfaces_list': interfaces_list})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index_machinetype(request):
|
def index_machinetype(request):
|
||||||
machinetype_list = MachineType.objects.order_by('type')
|
machinetype_list = MachineType.objects.order_by('type')
|
||||||
return render(request, 'machines/index_machinetype.html', {'machinetype_list':machinetype_list})
|
return render(request, 'machines/index_machinetype.html', {'machinetype_list':machinetype_list})
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# App de recherche pour re2o
|
# App de recherche pour re2o
|
||||||
# Gabriel Détraz, Goulven Kermarec
|
# Augustin lemesle, Gabriel Détraz, Goulven Kermarec
|
||||||
# Gplv2
|
# Gplv2
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.shortcuts import render_to_response, get_object_or_404
|
from django.shortcuts import render_to_response, get_object_or_404
|
||||||
from django.core.context_processors import csrf
|
from django.core.context_processors import csrf
|
||||||
from django.template import Context, RequestContext, loader
|
from django.template import Context, RequestContext, loader
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from users.models import User, Ban, Whitelist
|
from users.models import User, Ban, Whitelist
|
||||||
|
@ -20,6 +21,7 @@ def form(ctx, template, request):
|
||||||
c.update(csrf(request))
|
c.update(csrf(request))
|
||||||
return render_to_response(template, c, context_instance=RequestContext(request))
|
return render_to_response(template, c, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
@login_required
|
||||||
def search_result(search, type):
|
def search_result(search, type):
|
||||||
date_deb = None
|
date_deb = None
|
||||||
date_fin = None
|
date_fin = None
|
||||||
|
@ -80,6 +82,7 @@ def search_result(search, type):
|
||||||
switchlist = Switch.objects.filter(details__icontains = search)
|
switchlist = Switch.objects.filter(details__icontains = search)
|
||||||
return {'users_list': connexion, 'interfaces_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist}
|
return {'users_list': connexion, 'interfaces_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist}
|
||||||
|
|
||||||
|
@login_required
|
||||||
def search(request):
|
def search(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
search = SearchForm(request.POST or None)
|
search = SearchForm(request.POST or None)
|
||||||
|
@ -90,6 +93,7 @@ def search(request):
|
||||||
search = SearchForm(request.POST or None)
|
search = SearchForm(request.POST or None)
|
||||||
return form({'searchform': search}, 'search/search.html',request)
|
return form({'searchform': search}, 'search/search.html',request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def searchp(request):
|
def searchp(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
search = SearchFormPlus(request.POST or None)
|
search = SearchFormPlus(request.POST or None)
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
|
|
||||||
from topologie.models import Switch, Port
|
from topologie.models import Switch, Port
|
||||||
from topologie.forms import EditPortForm, EditSwitchForm, AddPortForm
|
from topologie.forms import EditPortForm, EditSwitchForm, AddPortForm
|
||||||
from users.views import form
|
from users.views import form
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index(request):
|
def index(request):
|
||||||
switch_list = Switch.objects.order_by('building', 'number')
|
switch_list = Switch.objects.order_by('building', 'number')
|
||||||
return render(request, 'topologie/index.html', {'switch_list': switch_list})
|
return render(request, 'topologie/index.html', {'switch_list': switch_list})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index_port(request, switch_id):
|
def index_port(request, switch_id):
|
||||||
try:
|
try:
|
||||||
switch = Switch.objects.get(pk=switch_id)
|
switch = Switch.objects.get(pk=switch_id)
|
||||||
|
@ -20,6 +22,7 @@ def index_port(request, switch_id):
|
||||||
port_list = Port.objects.filter(switch = switch).order_by('port')
|
port_list = Port.objects.filter(switch = switch).order_by('port')
|
||||||
return render(request, 'topologie/index_p.html', {'port_list':port_list, 'id_switch':switch_id, 'nom_switch':switch})
|
return render(request, 'topologie/index_p.html', {'port_list':port_list, 'id_switch':switch_id, 'nom_switch':switch})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def new_port(request, switch_id):
|
def new_port(request, switch_id):
|
||||||
try:
|
try:
|
||||||
switch = Switch.objects.get(pk=switch_id)
|
switch = Switch.objects.get(pk=switch_id)
|
||||||
|
@ -38,6 +41,7 @@ def new_port(request, switch_id):
|
||||||
return redirect("/topologie/switch/" + switch_id)
|
return redirect("/topologie/switch/" + switch_id)
|
||||||
return form({'topoform':port}, 'topologie/port.html', request)
|
return form({'topoform':port}, 'topologie/port.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_port(request, port_id):
|
def edit_port(request, port_id):
|
||||||
try:
|
try:
|
||||||
port = Port.objects.get(pk=port_id)
|
port = Port.objects.get(pk=port_id)
|
||||||
|
@ -51,6 +55,7 @@ def edit_port(request, port_id):
|
||||||
return redirect("/topologie/")
|
return redirect("/topologie/")
|
||||||
return form({'topoform':port}, 'topologie/port.html', request)
|
return form({'topoform':port}, 'topologie/port.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def new_switch(request):
|
def new_switch(request):
|
||||||
switch = EditSwitchForm(request.POST or None)
|
switch = EditSwitchForm(request.POST or None)
|
||||||
if switch.is_valid():
|
if switch.is_valid():
|
||||||
|
@ -59,6 +64,7 @@ def new_switch(request):
|
||||||
return redirect("/topologie/")
|
return redirect("/topologie/")
|
||||||
return form({'topoform':switch}, 'topologie/port.html', request)
|
return form({'topoform':switch}, 'topologie/port.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_switch(request, switch_id):
|
def edit_switch(request, switch_id):
|
||||||
try:
|
try:
|
||||||
switch = Switch.objects.get(pk=switch_id)
|
switch = Switch.objects.get(pk=switch_id)
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
<p><a href="{% url "users:index-ban" %}">Liste des 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:index-white" %}">Liste des accès à titre gracieux</a></p>
|
||||||
<p><a href="{% url "users:index-school" %}">Liste des établissements</a></p>
|
<p><a href="{% url "users:index-school" %}">Liste des établissements</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</a></p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -5,6 +5,7 @@ from django.shortcuts import render_to_response, render, redirect
|
||||||
from django.core.context_processors import csrf
|
from django.core.context_processors import csrf
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import Max, ProtectedError
|
from django.db.models import Max, ProtectedError
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
@ -91,7 +92,7 @@ def form(ctx, template, request):
|
||||||
context_instance=RequestContext(request)
|
context_instance=RequestContext(request)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def new_user(request):
|
def new_user(request):
|
||||||
user = InfoForm(request.POST or None)
|
user = InfoForm(request.POST or None)
|
||||||
if user.is_valid():
|
if user.is_valid():
|
||||||
|
@ -100,7 +101,7 @@ def new_user(request):
|
||||||
return redirect("/users/")
|
return redirect("/users/")
|
||||||
return form({'userform': user}, 'users/user.html', request)
|
return form({'userform': user}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_info(request, userid):
|
def edit_info(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -114,7 +115,7 @@ def edit_info(request, userid):
|
||||||
return redirect("/users/profil/" + userid)
|
return redirect("/users/profil/" + userid)
|
||||||
return form({'userform': user}, 'users/user.html', request)
|
return form({'userform': user}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def state(request, userid):
|
def state(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -133,7 +134,7 @@ def state(request, userid):
|
||||||
return redirect("/users/profil/" + userid)
|
return redirect("/users/profil/" + userid)
|
||||||
return form({'userform': state}, 'users/user.html', request)
|
return form({'userform': state}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def password(request, userid):
|
def password(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -152,6 +153,7 @@ def password(request, userid):
|
||||||
return redirect("/users/profil/" + userid)
|
return redirect("/users/profil/" + userid)
|
||||||
return form({'userform': u_form}, 'users/user.html', request)
|
return form({'userform': u_form}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def add_right(request, userid):
|
def add_right(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -170,7 +172,7 @@ def add_right(request, userid):
|
||||||
return redirect("/users/profil/" + userid)
|
return redirect("/users/profil/" + userid)
|
||||||
return form({'userform': right}, 'users/user.html', request)
|
return form({'userform': right}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def del_right(request):
|
def del_right(request):
|
||||||
right = DelRightForm(request.POST or None)
|
right = DelRightForm(request.POST or None)
|
||||||
if right.is_valid():
|
if right.is_valid():
|
||||||
|
@ -180,7 +182,7 @@ def del_right(request):
|
||||||
return redirect("/users/")
|
return redirect("/users/")
|
||||||
return form({'userform': right}, 'users/user.html', request)
|
return form({'userform': right}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def add_ban(request, userid):
|
def add_ban(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -200,7 +202,7 @@ def add_ban(request, userid):
|
||||||
)
|
)
|
||||||
return form({'userform': ban}, 'users/user.html', request)
|
return form({'userform': ban}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_ban(request, banid):
|
def edit_ban(request, banid):
|
||||||
try:
|
try:
|
||||||
ban_instance = Ban.objects.get(pk=banid)
|
ban_instance = Ban.objects.get(pk=banid)
|
||||||
|
@ -214,7 +216,7 @@ def edit_ban(request, banid):
|
||||||
return redirect("/users/")
|
return redirect("/users/")
|
||||||
return form({'userform': ban}, 'users/user.html', request)
|
return form({'userform': ban}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def add_whitelist(request, userid):
|
def add_whitelist(request, userid):
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=userid)
|
user = User.objects.get(pk=userid)
|
||||||
|
@ -234,7 +236,7 @@ def add_whitelist(request, userid):
|
||||||
)
|
)
|
||||||
return form({'userform': whitelist}, 'users/user.html', request)
|
return form({'userform': whitelist}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_whitelist(request, whitelistid):
|
def edit_whitelist(request, whitelistid):
|
||||||
try:
|
try:
|
||||||
whitelist_instance = Whitelist.objects.get(pk=whitelistid)
|
whitelist_instance = Whitelist.objects.get(pk=whitelistid)
|
||||||
|
@ -248,7 +250,7 @@ def edit_whitelist(request, whitelistid):
|
||||||
return redirect("/users/")
|
return redirect("/users/")
|
||||||
return form({'userform': whitelist}, 'users/user.html', request)
|
return form({'userform': whitelist}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def add_school(request):
|
def add_school(request):
|
||||||
school = SchoolForm(request.POST or None)
|
school = SchoolForm(request.POST or None)
|
||||||
if school.is_valid():
|
if school.is_valid():
|
||||||
|
@ -257,6 +259,7 @@ def add_school(request):
|
||||||
return redirect("/users/index_school/")
|
return redirect("/users/index_school/")
|
||||||
return form({'userform': school}, 'users/user.html', request)
|
return form({'userform': school}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def edit_school(request, schoolid):
|
def edit_school(request, schoolid):
|
||||||
try:
|
try:
|
||||||
school_instance = School.objects.get(pk=schoolid)
|
school_instance = School.objects.get(pk=schoolid)
|
||||||
|
@ -270,6 +273,7 @@ def edit_school(request, schoolid):
|
||||||
return redirect("/users/index_school/")
|
return redirect("/users/index_school/")
|
||||||
return form({'userform': school}, 'users/user.html', request)
|
return form({'userform': school}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def del_school(request):
|
def del_school(request):
|
||||||
school = DelSchoolForm(request.POST or None)
|
school = DelSchoolForm(request.POST or None)
|
||||||
if school.is_valid():
|
if school.is_valid():
|
||||||
|
@ -286,7 +290,7 @@ def del_school(request):
|
||||||
return redirect("/users/index_school/")
|
return redirect("/users/index_school/")
|
||||||
return form({'userform': school}, 'users/user.html', request)
|
return form({'userform': school}, 'users/user.html', request)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index(request):
|
def index(request):
|
||||||
users_list = User.objects.order_by('pk')
|
users_list = User.objects.order_by('pk')
|
||||||
connexion = []
|
connexion = []
|
||||||
|
@ -299,12 +303,12 @@ def index(request):
|
||||||
connexion.append([user, access, "Non adhérent"])
|
connexion.append([user, access, "Non adhérent"])
|
||||||
return render(request, 'users/index.html', {'users_list': connexion})
|
return render(request, 'users/index.html', {'users_list': connexion})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index_ban(request):
|
def index_ban(request):
|
||||||
ban_list = Ban.objects.order_by('date_start')
|
ban_list = Ban.objects.order_by('date_start')
|
||||||
return render(request, 'users/index_ban.html', {'ban_list': ban_list})
|
return render(request, 'users/index_ban.html', {'ban_list': ban_list})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index_white(request):
|
def index_white(request):
|
||||||
white_list = Whitelist.objects.order_by('date_start')
|
white_list = Whitelist.objects.order_by('date_start')
|
||||||
return render(
|
return render(
|
||||||
|
@ -313,11 +317,12 @@ def index_white(request):
|
||||||
{'white_list': white_list}
|
{'white_list': white_list}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@login_required
|
||||||
def index_school(request):
|
def index_school(request):
|
||||||
school_list = School.objects.order_by('name')
|
school_list = School.objects.order_by('name')
|
||||||
return render(request, 'users/index_schools.html', {'school_list':school_list})
|
return render(request, 'users/index_schools.html', {'school_list':school_list})
|
||||||
|
|
||||||
|
@login_required
|
||||||
def profil(request, userid):
|
def profil(request, userid):
|
||||||
try:
|
try:
|
||||||
users = User.objects.get(pk=userid)
|
users = User.objects.get(pk=userid)
|
||||||
|
|
Loading…
Reference in a new issue