mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-09 01:49:35 -06:00
parent
18862586e5
commit
10e76597a8
@ -1,6 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
from django.conf import settings
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from django.forms.fields import JSONField as _JSONField, InvalidJSONInput
|
from django.forms.fields import JSONField as _JSONField, InvalidJSONInput
|
||||||
from django.templatetags.static import static
|
from django.templatetags.static import static
|
||||||
@ -74,7 +75,8 @@ class TagFilterField(forms.MultipleChoiceField):
|
|||||||
count=Count('extras_taggeditem_items')
|
count=Count('extras_taggeditem_items')
|
||||||
).order_by('name')
|
).order_by('name')
|
||||||
return [
|
return [
|
||||||
(str(tag.slug), '{} ({})'.format(tag.name, tag.count)) for tag in tags
|
(settings.FILTERS_NULL_CHOICE_VALUE, settings.FILTERS_NULL_CHOICE_LABEL), # "None" option
|
||||||
|
*[(str(tag.slug), f'{tag.name} ({tag.count})') for tag in tags]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Choices are fetched each time the form is initialized
|
# Choices are fetched each time the form is initialized
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user