From 2f3557c18f1ff5bec8f85626e2786df534b357b7 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 27 Oct 2020 10:01:49 -0400 Subject: [PATCH] Fixes #5273: Fix exception when validating a new permission with no models selected --- docs/release-notes/version-2.9.md | 1 + netbox/users/admin.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 870f77ed4..f54b3a907 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -6,6 +6,7 @@ * [#3672](https://github.com/netbox-community/netbox/issues/3672) - Fix a caching issue causing incorrect related object counts in API responses * [#5113](https://github.com/netbox-community/netbox/issues/5113) - Fix incorrect caching of permission object assignments to user groups in the admin panel * [#5243](https://github.com/netbox-community/netbox/issues/5243) - Redirect user to appropriate tab after modifying device components +* [#5273](https://github.com/netbox-community/netbox/issues/5273) - Fix exception when validating a new permission with no models selected --- diff --git a/netbox/users/admin.py b/netbox/users/admin.py index 5228fe6bf..c03e6f740 100644 --- a/netbox/users/admin.py +++ b/netbox/users/admin.py @@ -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]