mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Normalement ca gere les bugs d'ajout et verifie la validité du domaine
Conflicts: machines/views.py
This commit is contained in:
parent
db7c9a1b76
commit
1ab67b75d2
2 changed files with 15 additions and 1 deletions
|
@ -76,6 +76,7 @@ class AliasForm(ModelForm):
|
||||||
fields = ['name','extension']
|
fields = ['name','extension']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
if 'infra' in kwargs:
|
||||||
infra = kwargs.pop('infra')
|
infra = kwargs.pop('infra')
|
||||||
if 'name_user' in kwargs:
|
if 'name_user' in kwargs:
|
||||||
name_user = kwargs.pop('name_user')
|
name_user = kwargs.pop('name_user')
|
||||||
|
|
|
@ -101,6 +101,7 @@ def new_machine(request, userid):
|
||||||
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=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)
|
||||||
|
<<<<<<< HEAD
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
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)
|
||||||
|
@ -140,6 +141,15 @@ def new_machine(request, userid):
|
||||||
messages.error(request, u"Adresse mac de taille incorrecte")
|
messages.error(request, u"Adresse mac de taille incorrecte")
|
||||||
return form({'machineform': machine, 'interfaceform': interface, 'domainform': domain}, 'machines/machine.html', request)
|
return form({'machineform': machine, 'interfaceform': interface, 'domainform': domain}, 'machines/machine.html', request)
|
||||||
>>>>>>> 5a7c1b3... Gestion de l'erreur sur les autres fctions
|
>>>>>>> 5a7c1b3... Gestion de l'erreur sur les autres fctions
|
||||||
|
=======
|
||||||
|
try:
|
||||||
|
if machine.is_valid() and interface.is_valid() and domain.is_valid():
|
||||||
|
new_machine = machine.save(commit=False)
|
||||||
|
new_machine.user = user
|
||||||
|
if len(interface.cleaned_data['mac_address']) != 12:
|
||||||
|
messages.error(request, u"Adresse mac trop courte")
|
||||||
|
return form({'machineform': machine, 'interfaceform': interface, 'domainform': domain}, 'machines/machine.html', request)
|
||||||
|
>>>>>>> 9be0510... Normalement ca gere les bugs d'ajout et verifie la validité du domaine
|
||||||
new_interface = interface.save(commit=False)
|
new_interface = interface.save(commit=False)
|
||||||
new_domain = domain.save(commit=False)
|
new_domain = domain.save(commit=False)
|
||||||
if full_domain_validator(request, new_domain):
|
if full_domain_validator(request, new_domain):
|
||||||
|
@ -165,10 +175,13 @@ def new_machine(request, userid):
|
||||||
return redirect("/users/profil/" + str(user.id))
|
return redirect("/users/profil/" + str(user.id))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
messages.error(request, u"Adresse mac invalide")
|
messages.error(request, u"Adresse mac invalide")
|
||||||
|
<<<<<<< HEAD
|
||||||
>>>>>>> b660cf0... Prise en compte des erreurs sur la mac
|
>>>>>>> b660cf0... Prise en compte des erreurs sur la mac
|
||||||
=======
|
=======
|
||||||
return redirect("/users/profil/" + user)
|
return redirect("/users/profil/" + user)
|
||||||
>>>>>>> 9b69205... Retour sur le profil de l'utilisateur apres suppression machine
|
>>>>>>> 9b69205... Retour sur le profil de l'utilisateur apres suppression machine
|
||||||
|
=======
|
||||||
|
>>>>>>> 9be0510... Normalement ca gere les bugs d'ajout et verifie la validité du domaine
|
||||||
return form({'machineform': machine, 'interfaceform': interface, 'domainform': domain}, 'machines/machine.html', request)
|
return form({'machineform': machine, 'interfaceform': interface, 'domainform': domain}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in a new issue