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

Include permissions in TemplatedAttr context

Jeremy Stretch 2 дней назад
Родитель
Сommit
623ab55d5b
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 0
      netbox/netbox/ui/attrs.py
  2. 1 1
      netbox/netbox/ui/panels.py

+ 1 - 0
netbox/netbox/ui/attrs.py

@@ -506,6 +506,7 @@ class TemplatedAttr(ObjectAttribute):
 
     def get_context(self, obj, context):
         return {
+            **context,
             **self.context,
             'object': obj,
         }

+ 1 - 1
netbox/netbox/ui/panels.py

@@ -187,7 +187,7 @@ class ObjectAttributesPanel(ObjectPanel, metaclass=ObjectAttributesPanelMeta):
             'attrs': [
                 {
                     'label': attr.label or self._name_to_label(name),
-                    'value': attr.render(ctx['object'], {'name': name}),
+                    'value': attr.render(ctx['object'], {'name': name, 'perms': ctx['perms']}),
                 } for name, attr in self._attrs.items() if name in attr_names
             ],
         }