mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Un adhérent par chambre et inversement (one to one)
This commit is contained in:
parent
a61c0762c2
commit
96b1413ca3
4 changed files with 10 additions and 4 deletions
Binary file not shown.
|
@ -7,7 +7,7 @@ class SwitchAdmin(admin.ModelAdmin):
|
||||||
list_display = ('building','number','details')
|
list_display = ('building','number','details')
|
||||||
|
|
||||||
class PortAdmin(admin.ModelAdmin):
|
class PortAdmin(admin.ModelAdmin):
|
||||||
list_display = ('switch', 'port','details')
|
list_display = ('switch', 'port','room','details')
|
||||||
|
|
||||||
class RoomAdmin(admin.ModelAdmin):
|
class RoomAdmin(admin.ModelAdmin):
|
||||||
list_display = ('building','room','number','details')
|
list_display = ('building','room','number','details')
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.contrib import admin
|
||||||
from .models import User, School, Right, ListRight, Ban
|
from .models import User, School, Right, ListRight, Ban
|
||||||
|
|
||||||
class UserAdmin(admin.ModelAdmin):
|
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):
|
class SchoolAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name',)
|
list_display = ('name',)
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.forms import ModelForm
|
from django.forms import ModelForm, Form
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from topologie.models import Room
|
||||||
|
|
||||||
class User(models.Model):
|
class User(models.Model):
|
||||||
STATE_ACTIVE = 0
|
STATE_ACTIVE = 0
|
||||||
STATE_DEACTIVATED = 1
|
STATE_DEACTIVATED = 1
|
||||||
|
@ -20,6 +22,7 @@ class User(models.Model):
|
||||||
email = models.EmailField()
|
email = models.EmailField()
|
||||||
school = models.ForeignKey('School', on_delete=models.PROTECT)
|
school = models.ForeignKey('School', on_delete=models.PROTECT)
|
||||||
promo = models.CharField(max_length=255)
|
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_ssha = models.CharField(max_length=255)
|
||||||
pwd_ntlm = models.CharField(max_length=255)
|
pwd_ntlm = models.CharField(max_length=255)
|
||||||
state = models.IntegerField(choices=STATES, default=STATE_ACTIVE)
|
state = models.IntegerField(choices=STATES, default=STATE_ACTIVE)
|
||||||
|
@ -79,7 +82,7 @@ class InfoForm(ModelForm):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ['name','surname','pseudo','email', 'school', 'promo']
|
fields = ['name','surname','pseudo','email', 'school', 'promo', 'room']
|
||||||
|
|
||||||
class PasswordForm(ModelForm):
|
class PasswordForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -127,3 +130,6 @@ class BanForm(ModelForm):
|
||||||
if date_end < timezone.now():
|
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")
|
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
|
return date_end
|
||||||
|
|
||||||
|
class ProfilForm(Form):
|
||||||
|
user =forms.CharField(label ='Ok', max_length=100)
|
||||||
|
|
Loading…
Reference in a new issue