1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #5273: Fix exception when validating a new permission with no models selected

This commit is contained in:
Jeremy Stretch
2020-10-27 10:01:49 -04:00
parent 478d82196a
commit 2f3557c18f
2 changed files with 2 additions and 1 deletions

View File

@ -185,7 +185,7 @@ class ObjectPermissionForm(forms.ModelForm):
# Validate the specified model constraints by attempting to execute a query. We don't care whether the query
# returns anything; we just want to make sure the specified constraints are valid.
if constraints:
if object_types and constraints:
# Normalize the constraints to a list of dicts
if type(constraints) is not list:
constraints = [constraints]