mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Remplace le nom donné à la main par le nom de la classe automatiquement
This commit is contained in:
parent
d65fbbf8d1
commit
172afb2e1e
6 changed files with 47 additions and 47 deletions
|
@ -30,7 +30,7 @@ from .models import Article, Paiement, Facture, Banque, Vente
|
||||||
|
|
||||||
class NewFactureForm(ModelForm):
|
class NewFactureForm(ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'facture')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(NewFactureForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(NewFactureForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['cheque'].required = False
|
self.fields['cheque'].required = False
|
||||||
self.fields['banque'].required = False
|
self.fields['banque'].required = False
|
||||||
|
@ -103,7 +103,7 @@ class ArticleForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'article')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ArticleForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ArticleForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = "Désignation de l'article"
|
self.fields['name'].label = "Désignation de l'article"
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class PaiementForm(ModelForm):
|
||||||
fields = ['moyen', 'type_paiement']
|
fields = ['moyen', 'type_paiement']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'paiement')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(PaiementForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(PaiementForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['moyen'].label = 'Moyen de paiement à ajouter'
|
self.fields['moyen'].label = 'Moyen de paiement à ajouter'
|
||||||
self.fields['type_paiement'].label = 'Type de paiement à ajouter'
|
self.fields['type_paiement'].label = 'Type de paiement à ajouter'
|
||||||
|
@ -130,7 +130,7 @@ class BanqueForm(ModelForm):
|
||||||
fields = ['name']
|
fields = ['name']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'banque')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(BanqueForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(BanqueForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = 'Banque à ajouter'
|
self.fields['name'].label = 'Banque à ajouter'
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class EditMachineForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'machine')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditMachineForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditMachineForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = 'Nom de la machine'
|
self.fields['name'].label = 'Nom de la machine'
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class EditInterfaceForm(ModelForm):
|
||||||
fields = ['machine', 'type', 'ipv4', 'mac_address', 'details']
|
fields = ['machine', 'type', 'ipv4', 'mac_address', 'details']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'interface')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditInterfaceForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditInterfaceForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['mac_address'].label = 'Adresse mac'
|
self.fields['mac_address'].label = 'Adresse mac'
|
||||||
self.fields['type'].label = 'Type de machine'
|
self.fields['type'].label = 'Type de machine'
|
||||||
|
@ -112,7 +112,7 @@ class AliasForm(ModelForm):
|
||||||
fields = ['name','extension']
|
fields = ['name','extension']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'domain')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
if 'infra' in kwargs:
|
if 'infra' in kwargs:
|
||||||
infra = kwargs.pop('infra')
|
infra = kwargs.pop('infra')
|
||||||
super(AliasForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(AliasForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
@ -128,7 +128,7 @@ class DomainForm(AliasForm):
|
||||||
initial = kwargs.get('initial', {})
|
initial = kwargs.get('initial', {})
|
||||||
initial['name'] = user.get_next_domain_name()
|
initial['name'] = user.get_next_domain_name()
|
||||||
kwargs['initial'] = initial
|
kwargs['initial'] = initial
|
||||||
prefix = kwargs.pop('prefix', 'domain')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(DomainForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(DomainForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class DelAliasForm(Form):
|
class DelAliasForm(Form):
|
||||||
|
@ -145,7 +145,7 @@ class MachineTypeForm(ModelForm):
|
||||||
fields = ['type','ip_type']
|
fields = ['type','ip_type']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'machinetype')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(MachineTypeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(MachineTypeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['type'].label = 'Type de machine à ajouter'
|
self.fields['type'].label = 'Type de machine à ajouter'
|
||||||
self.fields['ip_type'].label = "Type d'ip relié"
|
self.fields['ip_type'].label = "Type d'ip relié"
|
||||||
|
@ -159,7 +159,7 @@ class IpTypeForm(ModelForm):
|
||||||
fields = ['type','extension','need_infra','domaine_ip_start','domaine_ip_stop', 'prefix_v6', 'vlan']
|
fields = ['type','extension','need_infra','domaine_ip_start','domaine_ip_stop', 'prefix_v6', 'vlan']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'iptype')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(IpTypeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(IpTypeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['type'].label = 'Type ip à ajouter'
|
self.fields['type'].label = 'Type ip à ajouter'
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class ExtensionForm(ModelForm):
|
||||||
fields = ['name', 'need_infra', 'origin']
|
fields = ['name', 'need_infra', 'origin']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'extension')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ExtensionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ExtensionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = 'Extension à ajouter'
|
self.fields['name'].label = 'Extension à ajouter'
|
||||||
self.fields['origin'].label = 'Enregistrement A origin'
|
self.fields['origin'].label = 'Enregistrement A origin'
|
||||||
|
@ -190,7 +190,7 @@ class MxForm(ModelForm):
|
||||||
fields = ['zone', 'priority', 'name']
|
fields = ['zone', 'priority', 'name']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'mx')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(MxForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(MxForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].queryset = Domain.objects.exclude(interface_parent=None)
|
self.fields['name'].queryset = Domain.objects.exclude(interface_parent=None)
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ class NsForm(ModelForm):
|
||||||
fields = ['zone', 'ns']
|
fields = ['zone', 'ns']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'ns')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(NsForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(NsForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['ns'].queryset = Domain.objects.exclude(interface_parent=None)
|
self.fields['ns'].queryset = Domain.objects.exclude(interface_parent=None)
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ class TextForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'text')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(TextForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(TextForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class DelTextForm(Form):
|
class DelTextForm(Form):
|
||||||
|
@ -228,7 +228,7 @@ class NasForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'nas')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(NasForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(NasForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class DelNasForm(Form):
|
class DelNasForm(Form):
|
||||||
|
@ -240,7 +240,7 @@ class ServiceForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'service')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ServiceForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ServiceForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
@ -259,7 +259,7 @@ class VlanForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'vlan')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(VlanForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(VlanForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class DelVlanForm(Form):
|
class DelVlanForm(Form):
|
||||||
|
@ -271,7 +271,7 @@ class EditOuverturePortConfigForm(ModelForm):
|
||||||
fields = ['port_lists']
|
fields = ['port_lists']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'interface')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditOuverturePortConfigForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditOuverturePortConfigForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class EditOuverturePortListForm(ModelForm):
|
class EditOuverturePortListForm(ModelForm):
|
||||||
|
@ -280,6 +280,6 @@ class EditOuverturePortListForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'ouvertureportlist')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditOuverturePortListForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditOuverturePortListForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ def f_type_id( is_type_tt ):
|
||||||
""" The id that will be used in HTML to store the value of the field
|
""" The id that will be used in HTML to store the value of the field
|
||||||
type. Depends on the fact that type is generate using typeahead or not
|
type. Depends on the fact that type is generate using typeahead or not
|
||||||
"""
|
"""
|
||||||
return 'id_interface-type_hidden' if is_type_tt else 'id_interface-type'
|
return 'id_Interface-type_hidden' if is_type_tt else 'id_Interface-type'
|
||||||
|
|
||||||
def generate_ipv4_choices( form ) :
|
def generate_ipv4_choices( form ) :
|
||||||
""" Generate the parameter choices for the bootstrap_form_typeahead tag
|
""" Generate the parameter choices for the bootstrap_form_typeahead tag
|
||||||
|
|
|
@ -33,7 +33,7 @@ class EditOptionalUserForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'optionaluser')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditOptionalUserForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditOptionalUserForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['is_tel_mandatory'].label = 'Exiger un numéro de téléphone'
|
self.fields['is_tel_mandatory'].label = 'Exiger un numéro de téléphone'
|
||||||
self.fields['user_solde'].label = 'Activation du solde pour les utilisateurs'
|
self.fields['user_solde'].label = 'Activation du solde pour les utilisateurs'
|
||||||
|
@ -44,7 +44,7 @@ class EditOptionalMachineForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'optionalmachine')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditOptionalMachineForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditOptionalMachineForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['password_machine'].label = "Possibilité d'attribuer un mot de passe par interface"
|
self.fields['password_machine'].label = "Possibilité d'attribuer un mot de passe par interface"
|
||||||
self.fields['max_lambdauser_interfaces'].label = "Maximum d'interfaces autorisées pour un user normal"
|
self.fields['max_lambdauser_interfaces'].label = "Maximum d'interfaces autorisées pour un user normal"
|
||||||
|
@ -56,7 +56,7 @@ class EditOptionalTopologieForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'optionaltopologie')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditOptionalTopologieForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditOptionalTopologieForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['vlan_decision_ok'].label = "Vlan où placer les machines après acceptation RADIUS"
|
self.fields['vlan_decision_ok'].label = "Vlan où placer les machines après acceptation RADIUS"
|
||||||
self.fields['vlan_decision_nok'].label = "Vlan où placer les machines après rejet RADIUS"
|
self.fields['vlan_decision_nok'].label = "Vlan où placer les machines après rejet RADIUS"
|
||||||
|
@ -67,7 +67,7 @@ class EditGeneralOptionForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'generaloption')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditGeneralOptionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditGeneralOptionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['search_display_page'].label = 'Resultats affichés dans une recherche'
|
self.fields['search_display_page'].label = 'Resultats affichés dans une recherche'
|
||||||
self.fields['pagination_number'].label = 'Items par page, taille normale (ex users)'
|
self.fields['pagination_number'].label = 'Items par page, taille normale (ex users)'
|
||||||
|
@ -82,7 +82,7 @@ class EditAssoOptionForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'assooption')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditAssoOptionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditAssoOptionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = 'Nom de l\'asso'
|
self.fields['name'].label = 'Nom de l\'asso'
|
||||||
self.fields['siret'].label = 'SIRET'
|
self.fields['siret'].label = 'SIRET'
|
||||||
|
@ -99,7 +99,7 @@ class EditMailMessageOptionForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'mailmessageoption')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditMailMessageOptionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditMailMessageOptionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['welcome_mail_fr'].label = 'Message dans le mail de bienvenue en français'
|
self.fields['welcome_mail_fr'].label = 'Message dans le mail de bienvenue en français'
|
||||||
self.fields['welcome_mail_en'].label = 'Message dans le mail de bienvenue en anglais'
|
self.fields['welcome_mail_en'].label = 'Message dans le mail de bienvenue en anglais'
|
||||||
|
@ -110,7 +110,7 @@ class ServiceForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'service')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ServiceForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ServiceForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class DelServiceForm(Form):
|
class DelServiceForm(Form):
|
||||||
|
|
|
@ -32,7 +32,7 @@ class PortForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'port')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(PortForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(PortForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class EditPortForm(ModelForm):
|
class EditPortForm(ModelForm):
|
||||||
|
@ -40,7 +40,7 @@ class EditPortForm(ModelForm):
|
||||||
fields = ['room', 'related', 'machine_interface', 'radius', 'vlan_force', 'details']
|
fields = ['room', 'related', 'machine_interface', 'radius', 'vlan_force', 'details']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'port')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditPortForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditPortForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['machine_interface'].queryset = Interface.objects.all().select_related('domain__extension')
|
self.fields['machine_interface'].queryset = Interface.objects.all().select_related('domain__extension')
|
||||||
self.fields['related'].queryset = Port.objects.all().select_related('switch__switch_interface__domain__extension').order_by('switch', 'port')
|
self.fields['related'].queryset = Port.objects.all().select_related('switch__switch_interface__domain__extension').order_by('switch', 'port')
|
||||||
|
@ -50,7 +50,7 @@ class AddPortForm(ModelForm):
|
||||||
fields = ['port', 'room', 'machine_interface', 'related', 'radius', 'vlan_force', 'details']
|
fields = ['port', 'room', 'machine_interface', 'related', 'radius', 'vlan_force', 'details']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'port')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(AddPortForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(AddPortForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class StackForm(ModelForm):
|
class StackForm(ModelForm):
|
||||||
|
@ -59,7 +59,7 @@ class StackForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'stack')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(StackForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(StackForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class EditSwitchForm(ModelForm):
|
class EditSwitchForm(ModelForm):
|
||||||
|
@ -68,7 +68,7 @@ class EditSwitchForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'switch')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditSwitchForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditSwitchForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['location'].label = 'Localisation'
|
self.fields['location'].label = 'Localisation'
|
||||||
self.fields['number'].label = 'Nombre de ports'
|
self.fields['number'].label = 'Nombre de ports'
|
||||||
|
@ -78,7 +78,7 @@ class NewSwitchForm(ModelForm):
|
||||||
fields = ['location', 'number', 'details', 'stack', 'stack_member_id']
|
fields = ['location', 'number', 'details', 'stack', 'stack_member_id']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'switch')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(NewSwitchForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(NewSwitchForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class EditRoomForm(ModelForm):
|
class EditRoomForm(ModelForm):
|
||||||
|
@ -87,6 +87,6 @@ class EditRoomForm(ModelForm):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'room')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EditRoomForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditRoomForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class UserCreationForm(forms.ModelForm):
|
||||||
is_admin = forms.BooleanField(label='is admin')
|
is_admin = forms.BooleanField(label='is admin')
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'user')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(UserCreationForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(UserCreationForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -85,7 +85,7 @@ class ServiceUserCreationForm(forms.ModelForm):
|
||||||
password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput, min_length=8, max_length=255)
|
password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput, min_length=8, max_length=255)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'serviceuser')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ServiceUserCreationForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ServiceUserCreationForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -120,7 +120,7 @@ class UserChangeForm(forms.ModelForm):
|
||||||
fields = ('pseudo', 'password', 'name', 'surname', 'email')
|
fields = ('pseudo', 'password', 'name', 'surname', 'email')
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'user')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(UserChangeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(UserChangeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
print("User is admin : %s" % kwargs['instance'].is_admin)
|
print("User is admin : %s" % kwargs['instance'].is_admin)
|
||||||
self.initial['is_admin'] = kwargs['instance'].is_admin
|
self.initial['is_admin'] = kwargs['instance'].is_admin
|
||||||
|
@ -147,7 +147,7 @@ class ServiceUserChangeForm(forms.ModelForm):
|
||||||
password = ReadOnlyPasswordHashField()
|
password = ReadOnlyPasswordHashField()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'serviceuser')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ServiceUserChangeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ServiceUserChangeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -176,7 +176,7 @@ class MassArchiveForm(forms.Form):
|
||||||
|
|
||||||
class BaseInfoForm(ModelForm):
|
class BaseInfoForm(ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'user')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(BaseInfoForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(BaseInfoForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = 'Prénom'
|
self.fields['name'].label = 'Prénom'
|
||||||
self.fields['surname'].label = 'Nom'
|
self.fields['surname'].label = 'Nom'
|
||||||
|
@ -241,7 +241,7 @@ class PasswordForm(ModelForm):
|
||||||
fields = ['password', 'pwd_ntlm']
|
fields = ['password', 'pwd_ntlm']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'user')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(PasswordForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(PasswordForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class ServiceUserForm(ModelForm):
|
class ServiceUserForm(ModelForm):
|
||||||
|
@ -253,7 +253,7 @@ class ServiceUserForm(ModelForm):
|
||||||
fields = ('pseudo','access_group')
|
fields = ('pseudo','access_group')
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'serviceuser')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ServiceUserForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ServiceUserForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
class EditServiceUserForm(ServiceUserForm):
|
class EditServiceUserForm(ServiceUserForm):
|
||||||
|
@ -267,7 +267,7 @@ class StateForm(ModelForm):
|
||||||
fields = ['state']
|
fields = ['state']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'user')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(StateForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(StateForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ class SchoolForm(ModelForm):
|
||||||
fields = ['name']
|
fields = ['name']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'school')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(SchoolForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(SchoolForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = 'Établissement'
|
self.fields['name'].label = 'Établissement'
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ class ListRightForm(ModelForm):
|
||||||
fields = ['listright', 'details']
|
fields = ['listright', 'details']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'listright')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ListRightForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ListRightForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['listright'].label = 'Nom du droit/groupe'
|
self.fields['listright'].label = 'Nom du droit/groupe'
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ class DelSchoolForm(Form):
|
||||||
|
|
||||||
class RightForm(ModelForm):
|
class RightForm(ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'right')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(RightForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(RightForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['right'].label = 'Droit'
|
self.fields['right'].label = 'Droit'
|
||||||
self.fields['right'].empty_label = "Choisir un nouveau droit"
|
self.fields['right'].empty_label = "Choisir un nouveau droit"
|
||||||
|
@ -326,7 +326,7 @@ class DelRightForm(Form):
|
||||||
|
|
||||||
class BanForm(ModelForm):
|
class BanForm(ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'ban')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(BanForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(BanForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['date_end'].label = 'Date de fin'
|
self.fields['date_end'].label = 'Date de fin'
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ class BanForm(ModelForm):
|
||||||
|
|
||||||
class WhitelistForm(ModelForm):
|
class WhitelistForm(ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', 'whitelist')
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(WhitelistForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(WhitelistForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['date_end'].label = 'Date de fin'
|
self.fields['date_end'].label = 'Date de fin'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue