From 067e89f6a0aec0ac1badcc3c7d6993921fda5802 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 16 Jun 2020 14:59:22 -0400 Subject: [PATCH] Allow unrestricted access to assigned tags --- netbox/utilities/forms.py | 8 ++++++-- netbox/utilities/tables.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index 9c54e5cb5..875ee72fd 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -585,8 +585,12 @@ class TagFilterField(forms.MultipleChoiceField): def __init__(self, model, *args, **kwargs): def get_choices(): - tags = model.tags.annotate(count=Count('extras_taggeditem_items')).order_by('name') - return [(str(tag.slug), '{} ({})'.format(tag.name, tag.count)) for tag in tags] + tags = model.tags.all().unrestricted().annotate( + count=Count('extras_taggeditem_items') + ).order_by('name') + return [ + (str(tag.slug), '{} ({})'.format(tag.name, tag.count)) for tag in tags + ] # Choices are fetched each time the form is initialized super().__init__(label='Tags', choices=get_choices, required=False, *args, **kwargs) diff --git a/netbox/utilities/tables.py b/netbox/utilities/tables.py index 10e408b43..5e277e633 100644 --- a/netbox/utilities/tables.py +++ b/netbox/utilities/tables.py @@ -151,7 +151,7 @@ class TagColumn(tables.TemplateColumn): Display a list of tags assigned to the object. """ template_code = """ - {% for tag in value.all %} + {% for tag in value.all.unrestricted %} {% include 'utilities/templatetags/tag.html' %} {% empty %}