8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-27 17:33:45 +00:00

Bug réglé autocomplétion

This commit is contained in:
Dalahro 2017-01-09 16:20:13 +01:00 committed by root
parent 7cf2e52541
commit b7a665df9f
2 changed files with 7 additions and 6 deletions

View file

@ -70,6 +70,7 @@ class AliasForm(ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
infra = kwargs.pop('infra') infra = kwargs.pop('infra')
if 'name_user' in kwargs:
name_user = kwargs.pop('name_user') name_user = kwargs.pop('name_user')
nb_machine = kwargs.pop('nb_machine') nb_machine = kwargs.pop('nb_machine')
initial = kwargs.get('initial', {}) initial = kwargs.get('initial', {})

View file

@ -100,7 +100,7 @@ def new_machine(request, userid):
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',)))
nb_machine = Interface.objects.filter(machine__user=userid).count() 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) domain = AliasForm(request.POST or None, infra=request.user.has_perms(('infra',)), name_user=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