mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-20 18:48:45 -06:00
The weight field was explicitly declared with required=False in TagForm and TagImportForm, allowing empty submissions that would crash with a database IntegrityError since the column is NOT NULL. By removing the explicit field override, Django now auto-generates the form field from the model, which has default=1000 and is required. Co-authored-by: adionit7 <adionit7@users.noreply.github.com>
This commit is contained in:
@@ -271,10 +271,6 @@ class EventRuleImportForm(OwnerCSVMixin, NetBoxModelImportForm):
|
|||||||
|
|
||||||
class TagImportForm(OwnerCSVMixin, CSVModelForm):
|
class TagImportForm(OwnerCSVMixin, CSVModelForm):
|
||||||
slug = SlugField()
|
slug = SlugField()
|
||||||
weight = forms.IntegerField(
|
|
||||||
label=_('Weight'),
|
|
||||||
required=False
|
|
||||||
)
|
|
||||||
object_types = CSVMultipleContentTypeField(
|
object_types = CSVMultipleContentTypeField(
|
||||||
label=_('Object types'),
|
label=_('Object types'),
|
||||||
queryset=ObjectType.objects.with_feature('tags'),
|
queryset=ObjectType.objects.with_feature('tags'),
|
||||||
|
|||||||
@@ -571,10 +571,6 @@ class TagForm(ChangelogMessageMixin, OwnerMixin, forms.ModelForm):
|
|||||||
queryset=ObjectType.objects.with_feature('tags'),
|
queryset=ObjectType.objects.with_feature('tags'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
weight = forms.IntegerField(
|
|
||||||
label=_('Weight'),
|
|
||||||
required=False
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('name', 'slug', 'color', 'weight', 'description', 'object_types', name=_('Tag')),
|
FieldSet('name', 'slug', 'color', 'weight', 'description', 'object_types', name=_('Tag')),
|
||||||
|
|||||||
Reference in New Issue
Block a user