mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* Initial work on #11541 * Merge migrations * Limit tags by object type during assignment * Add tests for object type validation * Fix form field parameters
This commit is contained in:
@@ -204,15 +204,20 @@ class WebhookForm(BootstrapMixin, forms.ModelForm):
|
||||
|
||||
class TagForm(BootstrapMixin, forms.ModelForm):
|
||||
slug = SlugField()
|
||||
object_types = ContentTypeMultipleChoiceField(
|
||||
queryset=ContentType.objects.all(),
|
||||
limit_choices_to=FeatureQuery('tags'),
|
||||
required=False
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
('Tag', ('name', 'slug', 'color', 'description')),
|
||||
('Tag', ('name', 'slug', 'color', 'description', 'object_types')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Tag
|
||||
fields = [
|
||||
'name', 'slug', 'color', 'description'
|
||||
'name', 'slug', 'color', 'description', 'object_types',
|
||||
]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user