8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 11:53:12 +00:00

Machines sur le profil

This commit is contained in:
Gabriel Detraz 2016-07-04 03:01:09 +02:00
parent 5e9684f759
commit 6a66dd30e4
4 changed files with 9 additions and 8 deletions

View file

@ -47,7 +47,7 @@ def edit_machine(request, interfaceid):
machine_form.save() machine_form.save()
interface_form.save() interface_form.save()
messages.success(request, "La machine a été modifiée") messages.success(request, "La machine a été modifiée")
return redirect("/users/") 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)
def new_interface(request, machineid): def new_interface(request, machineid):
@ -64,7 +64,7 @@ def new_interface(request, machineid):
new_interface.machine = machine new_interface.machine = machine
new_interface.save() new_interface.save()
messages.success(request, "L'interface a été ajoutée") messages.success(request, "L'interface a été ajoutée")
return redirect("/users/") 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)
def index(request): def index(request):

View file

@ -28,7 +28,7 @@
<div class="collapse navbar-collapse" id="myNavbar"> <div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li><a href="{% url "users:index" %}">Adhérents</a></li> <li><a href="{% url "users:index" %}">Adhérents</a></li>
<li><a href="#">Machines</a></li> <li><a href="{% url "machines:index" %}">Machines</a></li>
<li><a href="{% url "cotisations:index" %}">Cotisations</a></li> <li><a href="{% url "cotisations:index" %}">Cotisations</a></li>
<li><a href="#">Topologie</a></li> <li><a href="#">Topologie</a></li>
<li><a href="#">Statistiques</a></li> <li><a href="#">Statistiques</a></li>

View file

@ -6,7 +6,7 @@
{% block content %} {% block content %}
<h2>Adhérent</h2> <h2>Adhérent</h2>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' user.id %}"><i class="glyphicon glyphicon-fire"></i> Editer</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' user.id %}"><i class="glyphicon glyphicon-fire"></i> Editer</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' user.id %}"><i class="glyphicon glyphicon-leaf"></i> Changer le mot de passe</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' user.id %}"><i class="glyphicon glyphicon-lock"></i> Changer le mot de passe</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' user.id %}"><i class="glyphicon glyphicon-flash"></i> Changer le statut</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' user.id %}"><i class="glyphicon glyphicon-flash"></i> Changer le statut</a>
<br /> <br />
<br /> <br />
@ -66,8 +66,9 @@
{% endif %} {% endif %}
</table> </table>
<h2>Machines :</h2> <h2>Machines :</h2>
<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' user.id %}"><i class="glyphicon glyphicon-phone"></i> Ajouter une machine</a></h4>
{% if machine_list %} {% if machine_list %}
<!-- {% include "machine/aff_machines.html" with machine_list=machine_list } --> {% include "machines/aff_machines.html" with machine_list=machine_list %}
{% else %} {% else %}
<p>Aucune machine</p> <p>Aucune machine</p>
{% endif %} {% endif %}
@ -79,7 +80,7 @@
<p>Aucune facture</p> <p>Aucune facture</p>
{% endif %} {% endif %}
<h2>Bannissements :</h2> <h2>Bannissements :</h2>
<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' user.id %}"><i class="glyphicon glyphicon-tint"></i> Ajouter un bannissement</a></h4> <h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' user.id %}"><i class="glyphicon glyphicon-pushpin"></i> Ajouter un bannissement</a></h4>
{% if ban_list %} {% if ban_list %}
{% include "users/aff_bans.html" with ban_list=ban_list %} {% include "users/aff_bans.html" with ban_list=ban_list %}
{% else %} {% else %}

View file

@ -11,7 +11,7 @@ from django.utils import timezone
from users.models import User, Right, Ban, DelRightForm, UserForm, InfoForm, PasswordForm, StateForm, RightForm, BanForm, ProfilForm from users.models import User, Right, Ban, DelRightForm, UserForm, InfoForm, PasswordForm, StateForm, RightForm, BanForm, ProfilForm
from cotisations.models import Facture from cotisations.models import Facture
from machines.models import Machine from machines.models import Machine, Interface
from users.forms import PassForm from users.forms import PassForm
from search.models import SearchForm from search.models import SearchForm
from cotisations.views import is_adherent, end_adhesion from cotisations.views import is_adherent, end_adhesion
@ -156,7 +156,7 @@ def profil(request):
if profil.is_valid(): if profil.is_valid():
profils = profil.cleaned_data['user'] profils = profil.cleaned_data['user']
users = User.objects.get(pseudo = profils) users = User.objects.get(pseudo = profils)
machines = None machines = Interface.objects.filter(machine=Machine.objects.filter(user__pseudo = users))
factures = Facture.objects.filter(user__pseudo = users) factures = Facture.objects.filter(user__pseudo = users)
bans = Ban.objects.filter(user__pseudo = users) bans = Ban.objects.filter(user__pseudo = users)
end = None end = None