Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 839d88a0 authored by moamoak's avatar moamoak

Merge branch 'Fix_130' into 'master'

Fix #130: Check the right value for need_infra filtering

Closes #130

See merge request federez/re2o!171
parents 82e0dc8c 8573e2b8
...@@ -99,7 +99,8 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): ...@@ -99,7 +99,8 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
self.fields['ipv4'].queryset = IpList.objects.filter( self.fields['ipv4'].queryset = IpList.objects.filter(
interface__isnull=True interface__isnull=True
) )
if not IpType.can_use_all(user): can_use_all_iptype, _reason = IpType.can_use_all(user)
if not can_use_all_iptype:
self.fields['ipv4'].queryset = IpList.objects.filter( self.fields['ipv4'].queryset = IpList.objects.filter(
interface__isnull=True interface__isnull=True
).filter(ip_type__in=IpType.objects.filter(need_infra=False)) ).filter(ip_type__in=IpType.objects.filter(need_infra=False))
...@@ -114,7 +115,8 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): ...@@ -114,7 +115,8 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
if "machine" in self.fields: if "machine" in self.fields:
self.fields['machine'].queryset = Machine.objects.all()\ self.fields['machine'].queryset = Machine.objects.all()\
.select_related('user') .select_related('user')
if not MachineType.can_use_all(user): can_use_all_machinetype, _reason = MachineType.can_use_all(user)
if not can_use_all_machinetype:
self.fields['type'].queryset = MachineType.objects.filter( self.fields['type'].queryset = MachineType.objects.filter(
ip_type__in=IpType.objects.filter(need_infra=False) ip_type__in=IpType.objects.filter(need_infra=False)
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment