mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-09 19:03:48 +02:00
cleanup
This commit is contained in:
@@ -277,7 +277,7 @@ class CustomFieldChoiceSetTest(APIViewTestCases.APIViewTestCase):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
response = self.client.post(self.url_list, data, format='json', **self.header)
|
response = self.client.post(self._get_list_url(), data, format='json', **self.header)
|
||||||
self.assertEqual(response.status_code, 400)
|
self.assertEqual(response.status_code, 400)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from django.apps import apps
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.backends import ModelBackend
|
from django.contrib.auth.backends import ModelBackend
|
||||||
from django.contrib.auth.backends import RemoteUserBackend as _RemoteUserBackend
|
from django.contrib.auth.backends import RemoteUserBackend as _RemoteUserBackend
|
||||||
@@ -141,15 +140,9 @@ class ObjectPermissionMixin:
|
|||||||
# Sanity check: Ensure that the requested permission applies to the specified object
|
# Sanity check: Ensure that the requested permission applies to the specified object
|
||||||
model = obj._meta.concrete_model
|
model = obj._meta.concrete_model
|
||||||
if model._meta.label_lower != '.'.join((app_label, model_name)):
|
if model._meta.label_lower != '.'.join((app_label, model_name)):
|
||||||
# Allow proxy models: the permission may name a proxy whose concrete model matches
|
raise ValueError(_("Invalid permission {permission} for model {model}").format(
|
||||||
try:
|
permission=perm, model=model
|
||||||
perm_model = apps.get_model(app_label, model_name)
|
))
|
||||||
except LookupError:
|
|
||||||
perm_model = None
|
|
||||||
if perm_model is None or perm_model._meta.concrete_model != model:
|
|
||||||
raise ValueError(_("Invalid permission {permission} for model {model}").format(
|
|
||||||
permission=perm, model=model
|
|
||||||
))
|
|
||||||
|
|
||||||
# Compile a QuerySet filter that matches all instances of the specified model
|
# Compile a QuerySet filter that matches all instances of the specified model
|
||||||
tokens = {
|
tokens = {
|
||||||
|
|||||||
Reference in New Issue
Block a user