Просмотр исходного кода

Set the default action to 'view' for restrict()

Jeremy Stretch 5 лет назад
Родитель
Сommit
9777f25b9f
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      netbox/utilities/querysets.py

+ 2 - 2
netbox/utilities/querysets.py

@@ -59,13 +59,13 @@ class RestrictedQuerySet(QuerySet):
         self.allow_evaluation = True
         self.allow_evaluation = True
         return self
         return self
 
 
-    def restrict(self, user, action):
+    def restrict(self, user, action='view'):
         """
         """
         Filter the QuerySet to return only objects on which the specified user has been granted the specified
         Filter the QuerySet to return only objects on which the specified user has been granted the specified
         permission.
         permission.
 
 
         :param user: User instance
         :param user: User instance
-        :param action: The action which must be permitted (e.g. "view" for "dcim.view_site")
+        :param action: The action which must be permitted (e.g. "view" for "dcim.view_site"); default is 'view'
         """
         """
         # Resolve the full name of the required permission
         # Resolve the full name of the required permission
         app_label = self.model._meta.app_label
         app_label = self.model._meta.app_label