mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-08-20 06:03:40 +00:00
Fix #130: Check the right value for need_infra filtering
This commit is contained in:
parent
acb41cf375
commit
8573e2b8d1
1 changed files with 4 additions and 2 deletions
|
@ -99,7 +99,8 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
|||
self.fields['ipv4'].queryset = IpList.objects.filter(
|
||||
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(
|
||||
interface__isnull=True
|
||||
).filter(ip_type__in=IpType.objects.filter(need_infra=False))
|
||||
|
@ -114,7 +115,8 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
|||
if "machine" in self.fields:
|
||||
self.fields['machine'].queryset = Machine.objects.all()\
|
||||
.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(
|
||||
ip_type__in=IpType.objects.filter(need_infra=False)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue