mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Autocompletion du dns basique
This commit is contained in:
parent
c8d685defe
commit
cf45288821
2 changed files with 7 additions and 1 deletions
|
@ -70,6 +70,11 @@ class AliasForm(ModelForm):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
infra = kwargs.pop('infra')
|
infra = kwargs.pop('infra')
|
||||||
|
name_user = kwargs.pop('name_user')
|
||||||
|
nb_machine = kwargs.pop('nb_machine')
|
||||||
|
initial = kwargs.get('initial', {})
|
||||||
|
initial['name'] = name_user.lower()+str(nb_machine)
|
||||||
|
kwargs['initial'] = initial
|
||||||
super(AliasForm, self).__init__(*args, **kwargs)
|
super(AliasForm, self).__init__(*args, **kwargs)
|
||||||
if not infra:
|
if not infra:
|
||||||
self.fields['extension'].queryset = Extension.objects.filter(need_infra=False)
|
self.fields['extension'].queryset = Extension.objects.filter(need_infra=False)
|
||||||
|
|
|
@ -99,7 +99,8 @@ def new_machine(request, userid):
|
||||||
return redirect("/users/profil/" + str(request.user.id))
|
return redirect("/users/profil/" + str(request.user.id))
|
||||||
machine = NewMachineForm(request.POST or None)
|
machine = NewMachineForm(request.POST or None)
|
||||||
interface = AddInterfaceForm(request.POST or None, infra=request.user.has_perms(('infra',)))
|
interface = AddInterfaceForm(request.POST or None, infra=request.user.has_perms(('infra',)))
|
||||||
domain = AliasForm(request.POST or None, infra=request.user.has_perms(('infra',)))
|
nb_machine = Interface.objects.filter(machine__user=userid).count()
|
||||||
|
domain = AliasForm(request.POST or None, infra=request.user.has_perms(('infra',)), name_user=request.user.surname, nb_machine=nb_machine)
|
||||||
if machine.is_valid() and interface.is_valid():
|
if machine.is_valid() and interface.is_valid():
|
||||||
new_machine = machine.save(commit=False)
|
new_machine = machine.save(commit=False)
|
||||||
new_machine.user = user
|
new_machine.user = user
|
||||||
|
|
Loading…
Reference in a new issue