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

Add TextVar for large text entry

This commit is contained in:
Jeremy Stretch
2019-08-14 16:20:52 -04:00
parent 47d60dbb20
commit cb0dbc0769

View File

@ -3,7 +3,6 @@ import inspect
import json
import os
import pkgutil
import sys
import time
import traceback
import yaml
@ -24,6 +23,7 @@ from .forms import ScriptForm
__all__ = [
'Script',
'StringVar',
'TextVar',
'IntegerVar',
'BooleanVar',
'ObjectVar',
@ -87,6 +87,18 @@ class StringVar(ScriptVariable):
]
class TextVar(ScriptVariable):
"""
Free-form text data. Renders as a <textarea>.
"""
form_field = forms.CharField
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.field_attrs['widget'] = forms.Textarea
class IntegerVar(ScriptVariable):
"""
Integer representation. Can enforce minimum/maximum values.