mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 07:02:26 +00:00
Ajoute des etiquettes, factorise un peu le code des modèles avec de l'heritage
This commit is contained in:
parent
49a3041c61
commit
9436331c26
3 changed files with 15 additions and 15 deletions
|
@ -56,6 +56,8 @@ class NewFactureForm(ModelForm):
|
|||
self.fields['cheque'].required = False
|
||||
self.fields['banque'].required = False
|
||||
self.fields['cheque'].label = 'Numero de chèque'
|
||||
self.fields['banque'].empty_label = "Non renseigné"
|
||||
self.fields['paiement'].empty_label = "Séléctionner un moyen de paiement"
|
||||
|
||||
class Meta:
|
||||
model = Facture
|
||||
|
@ -71,6 +73,9 @@ class EditFactureForm(ModelForm):
|
|||
self.fields['cheque'].label = 'Numero de chèque'
|
||||
self.fields['name'].label = 'Designation'
|
||||
self.fields['prix'].label = 'Prix unitaire'
|
||||
self.fields['banque'].empty_label = "Non renseigné"
|
||||
self.fields['paiement'].empty_label = "Séléctionner un moyen de paiement"
|
||||
self.fields['user'].empty_label = "Séléctionner l'adhérent propriétaire"
|
||||
|
||||
class Meta:
|
||||
model = Facture
|
||||
|
|
|
@ -25,7 +25,7 @@ class Interface(models.Model):
|
|||
mac_address = MACAddressField(integer=False, unique=True)
|
||||
machine = models.ForeignKey('Machine', on_delete=models.PROTECT)
|
||||
details = models.CharField(max_length=255, blank=True)
|
||||
dns = models.CharField(help_text="Obligatoire et unique", max_length=255, unique=True)
|
||||
dns = models.CharField(help_text="Obligatoire et unique, doit se terminer en .rez et ne pas comporter de points", max_length=255, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.dns
|
||||
|
@ -45,6 +45,7 @@ class EditMachineForm(ModelForm):
|
|||
super(EditMachineForm, self).__init__(*args, **kwargs)
|
||||
self.fields['name'].label = 'Nom de la machine'
|
||||
self.fields['type'].label = 'Type de machine'
|
||||
self.fields['type'].empty_label = "Séléctionner un type de machine"
|
||||
|
||||
class NewMachineForm(EditMachineForm):
|
||||
class Meta(EditMachineForm.Meta):
|
||||
|
|
|
@ -29,7 +29,7 @@ class User(models.Model):
|
|||
surname = models.CharField(max_length=255)
|
||||
pseudo = models.CharField(max_length=255, unique=True)
|
||||
email = models.EmailField()
|
||||
school = models.ForeignKey('School', on_delete=models.PROTECT)
|
||||
school = models.ForeignKey('School', on_delete=models.PROTECT, null=False, blank=False)
|
||||
comment = models.CharField(help_text="Commentaire, promo", max_length=255, blank=True)
|
||||
room = models.OneToOneField('topologie.Room', on_delete=models.PROTECT, blank=True, null=True)
|
||||
pwd_ssha = models.CharField(max_length=255)
|
||||
|
@ -80,19 +80,6 @@ class Whitelist(models.Model):
|
|||
def __str__(self):
|
||||
return str(self.user) + ' ' + str(self.raison)
|
||||
|
||||
class UserForm(ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(InfoForm, self).__init__(*args, **kwargs)
|
||||
self.fields['name'].label = 'Nom'
|
||||
self.fields['surname'].label = 'Prénom'
|
||||
self.fields['school'].label = 'Établissement'
|
||||
self.fields['comment'].label = 'Commentaire'
|
||||
self.fields['room'].label = 'Chambre'
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
fields = '__all__'
|
||||
|
||||
class InfoForm(ModelForm):
|
||||
force = forms.BooleanField(label="Forcer le déménagement ?", initial=False, required=False)
|
||||
|
||||
|
@ -103,6 +90,8 @@ class InfoForm(ModelForm):
|
|||
self.fields['school'].label = 'Établissement'
|
||||
self.fields['comment'].label = 'Commentaire'
|
||||
self.fields['room'].label = 'Chambre'
|
||||
self.fields['room'].empty_label = "Pas de chambre"
|
||||
self.fields['school'].empty_label = "Séléctionner un établissement"
|
||||
|
||||
def clean_force(self):
|
||||
if self.cleaned_data.get('force', False):
|
||||
|
@ -113,6 +102,10 @@ class InfoForm(ModelForm):
|
|||
model = User
|
||||
fields = ['name','surname','pseudo','email', 'school', 'comment', 'room']
|
||||
|
||||
class UserForm(InfoForm):
|
||||
class Meta(InfoForm.Meta):
|
||||
fields = '__all__'
|
||||
|
||||
class PasswordForm(ModelForm):
|
||||
class Meta:
|
||||
model = User
|
||||
|
@ -132,6 +125,7 @@ class RightForm(ModelForm):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(RightForm, self).__init__(*args, **kwargs)
|
||||
self.fields['right'].label = 'Droit'
|
||||
self.fields['right'].empty_label = "Choisir un nouveau droit"
|
||||
|
||||
class Meta:
|
||||
model = Right
|
||||
|
|
Loading…
Reference in a new issue