diff --git a/topologie/__pycache__/admin.cpython-34.pyc b/topologie/__pycache__/admin.cpython-34.pyc index 398466f3..043813fe 100644 Binary files a/topologie/__pycache__/admin.cpython-34.pyc and b/topologie/__pycache__/admin.cpython-34.pyc differ diff --git a/topologie/admin.py b/topologie/admin.py index 7c06c2e0..f1e7fb6e 100644 --- a/topologie/admin.py +++ b/topologie/admin.py @@ -7,7 +7,7 @@ class SwitchAdmin(admin.ModelAdmin): list_display = ('building','number','details') class PortAdmin(admin.ModelAdmin): - list_display = ('switch', 'port','details') + list_display = ('switch', 'port','room','details') class RoomAdmin(admin.ModelAdmin): list_display = ('building','room','number','details') diff --git a/users/admin.py b/users/admin.py index cbbcbf98..70307df0 100644 --- a/users/admin.py +++ b/users/admin.py @@ -3,7 +3,7 @@ from django.contrib import admin from .models import User, School, Right, ListRight, Ban class UserAdmin(admin.ModelAdmin): - list_display = ('name','surname','pseudo','email', 'school', 'state') + list_display = ('name','surname','pseudo','room','email', 'school', 'state') class SchoolAdmin(admin.ModelAdmin): list_display = ('name',) diff --git a/users/models.py b/users/models.py index 50931404..4490f3f2 100644 --- a/users/models.py +++ b/users/models.py @@ -1,9 +1,11 @@ from django.db import models -from django.forms import ModelForm +from django.forms import ModelForm, Form from django import forms from django.utils import timezone +from topologie.models import Room + class User(models.Model): STATE_ACTIVE = 0 STATE_DEACTIVATED = 1 @@ -20,6 +22,7 @@ class User(models.Model): email = models.EmailField() school = models.ForeignKey('School', on_delete=models.PROTECT) promo = models.CharField(max_length=255) + room = models.OneToOneField('topologie.Room', on_delete=models.PROTECT, blank=True, null=True) pwd_ssha = models.CharField(max_length=255) pwd_ntlm = models.CharField(max_length=255) state = models.IntegerField(choices=STATES, default=STATE_ACTIVE) @@ -79,7 +82,7 @@ class InfoForm(ModelForm): class Meta: model = User - fields = ['name','surname','pseudo','email', 'school', 'promo'] + fields = ['name','surname','pseudo','email', 'school', 'promo', 'room'] class PasswordForm(ModelForm): class Meta: @@ -127,3 +130,6 @@ class BanForm(ModelForm): if date_end < timezone.now(): raise forms.ValidationError("Triple buse, la date de fin ne peut pas ĂȘtre avant maintenant... Re2o ne voyage pas dans le temps") return date_end + +class ProfilForm(Form): + user =forms.CharField(label ='Ok', max_length=100)