1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #9687: Don't restrict custom text field lengths when entering via UI form

This commit is contained in:
jeremystretch
2022-07-11 11:12:06 -04:00
parent 7c109ffd8c
commit 5a4467a4a8
3 changed files with 4 additions and 8 deletions

View File

@ -365,13 +365,8 @@ class CustomField(ExportTemplatesMixin, WebhooksMixin, ChangeLoggedModel):
# Text
else:
if self.type == CustomFieldTypeChoices.TYPE_LONGTEXT:
max_length = None
widget = forms.Textarea
else:
max_length = 255
widget = None
field = forms.CharField(max_length=max_length, required=required, initial=initial, widget=widget)
widget = forms.Textarea if self.type == CustomFieldTypeChoices.TYPE_LONGTEXT else None
field = forms.CharField(required=required, initial=initial, widget=widget)
if self.validation_regex:
field.validators = [
RegexValidator(