Python django.forms.widgets.Textarea() Examples
The following are 21
code examples of django.forms.widgets.Textarea().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.forms.widgets
, or try the search function
.
Example #1
Source File: forms.py From django-cas-server with GNU General Public License v3.0 | 6 votes |
def __init__(self, *args, **kwargs): super(BootsrapForm, self).__init__(*args, **kwargs) for field in self.fields.values(): # Only tweak the field if it will be displayed if not isinstance(field.widget, widgets.HiddenInput): attrs = {} if ( isinstance(field.widget, (widgets.Input, widgets.Select, widgets.Textarea)) and not isinstance(field.widget, (widgets.CheckboxInput,)) ): attrs['class'] = "form-control" if isinstance(field.widget, (widgets.Input, widgets.Textarea)) and field.label: attrs["placeholder"] = field.label if field.required: attrs["required"] = "required" field.widget.attrs.update(attrs)
Example #2
Source File: boundfield.py From bioforum with MIT License | 5 votes |
def as_textarea(self, attrs=None, **kwargs): """Return a string of HTML for representing this as a <textarea>.""" return self.as_widget(Textarea(), attrs, **kwargs)
Example #3
Source File: forms.py From steemprojects.com with MIT License | 5 votes |
def __init__(self, *args, **kwargs): super(PackageForm, self).__init__(*args, **kwargs) self.fields['category'].help_text = package_help_text() self.fields['repo_url'].widget = TextInput(attrs={ 'placeholder': 'ex: https://github.com/steemit/steem' }) self.fields['description'].widget = Textarea(attrs={ "placeholder": "Write few sentences about this projects. What problem does it solve? Who is it for?" }) self.fields['contact_url'].widget = TextInput(attrs={ "placeholder": "Link to channel on steemit.chat, discord, slack, etc" })
Example #4
Source File: test_json.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_widget(self): """The default widget of a JSONField is a Textarea.""" field = forms.JSONField() self.assertIsInstance(field.widget, widgets.Textarea)
Example #5
Source File: test_json.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_widget(self): """The default widget of a JSONField is a Textarea.""" field = forms.JSONField() self.assertIsInstance(field.widget, widgets.Textarea)
Example #6
Source File: boundfield.py From python2017 with MIT License | 5 votes |
def as_textarea(self, attrs=None, **kwargs): "Returns a string of HTML for representing this as a <textarea>." return self.as_widget(Textarea(), attrs, **kwargs)
Example #7
Source File: boundfield.py From openhgsenti with Apache License 2.0 | 5 votes |
def as_textarea(self, attrs=None, **kwargs): "Returns a string of HTML for representing this as a <textarea>." return self.as_widget(Textarea(), attrs, **kwargs)
Example #8
Source File: forms.py From luscan-devel with GNU General Public License v2.0 | 5 votes |
def as_textarea(self, attrs=None, **kwargs): "Returns a string of HTML for representing this as a <textarea>." return self.as_widget(Textarea(), attrs, **kwargs)
Example #9
Source File: boundfield.py From python with Apache License 2.0 | 5 votes |
def as_textarea(self, attrs=None, **kwargs): "Returns a string of HTML for representing this as a <textarea>." return self.as_widget(Textarea(), attrs, **kwargs)
Example #10
Source File: boundfield.py From Hands-On-Application-Development-with-PyCharm with MIT License | 5 votes |
def as_textarea(self, attrs=None, **kwargs): """Return a string of HTML for representing this as a <textarea>.""" return self.as_widget(Textarea(), attrs, **kwargs)
Example #11
Source File: archive.py From coursys with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Archive.ComponentForm, self).__init__(*args, **kwargs) self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5})
Example #12
Source File: forms.py From GTDWeb with GNU General Public License v2.0 | 5 votes |
def as_textarea(self, attrs=None, **kwargs): "Returns a string of HTML for representing this as a <textarea>." return self.as_widget(Textarea(), attrs, **kwargs)
Example #13
Source File: url.py From coursys with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(URL.ComponentForm, self).__init__(*args, **kwargs) self.fields.__delitem__('specified_filename') self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5})
Example #14
Source File: codefile.py From coursys with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Codefile.ComponentForm, self).__init__(*args, **kwargs) self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5}) self.fields['max_size'].widget = TextInput(attrs={'style':'width:5em'}) del self.fields['specified_filename'] # our filename and filename.type do a better job
Example #15
Source File: word.py From coursys with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Word.ComponentForm, self).__init__(*args, **kwargs) self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5}) self.fields['max_size'].label=mark_safe("Max size")
Example #16
Source File: office.py From coursys with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Office.ComponentForm, self).__init__(*args, **kwargs) self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5}) self.fields['allowed'].widget = SelectMultiple(choices=OFFICE_CHOICES, attrs={'style':'width:40em', 'size': 15}) self.initial['allowed'] = self._initial_allowed
Example #17
Source File: image.py From coursys with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Image.ComponentForm, self).__init__(*args, **kwargs) self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5})
Example #18
Source File: text.py From coursys with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Text.ComponentForm, self).__init__(*args, **kwargs) self.fields.__delitem__('specified_filename') self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5})
Example #19
Source File: code.py From coursys with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Code.ComponentForm, self).__init__(*args, **kwargs) self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5}) self.fields['max_size'].widget = TextInput(attrs={'style':'width:5em'}) self.fields['allowed'].widget = SelectMultiple(choices=CODE_TYPES, attrs={'style':'width:40em', 'size': 15}) self.initial['allowed'] = self._initial_allowed
Example #20
Source File: livecode.py From coursys with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(LiveCode.ComponentForm, self).__init__(*args, **kwargs) self.fields.__delitem__('specified_filename') self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5})
Example #21
Source File: views.py From panhandler with Apache License 2.0 | 4 votes |
def generate_dynamic_form(self, data=None) -> Form: form = Form(data=data) meta = self.meta if meta is None: raise SnippetRequiredException('Could not find a valid skillet!!') mode = self.get_value_from_workflow('mode', 'online') if mode == 'online': self.title = 'PAN-OS NGFW to Validate' self.help_text = 'This form allows you to enter the connection information for a PAN-OS NGFW. This' \ 'tool will connect to that device and pull it\'s configuration to perform the' \ 'validation.' target_ip_label = 'Target IP' target_username_label = 'Target Username' target_password_label = 'Target Password' target_ip = self.get_value_from_workflow('TARGET_IP', '') # target_port = self.get_value_from_workflow('TARGET_PORT', 443) target_username = self.get_value_from_workflow('TARGET_USERNAME', '') target_password = self.get_value_from_workflow('TARGET_PASSWORD', '') target_ip_field = fields.CharField(label=target_ip_label, initial=target_ip, required=True, validators=[FqdnOrIp]) target_username_field = fields.CharField(label=target_username_label, initial=target_username, required=True) target_password_field = fields.CharField(widget=widgets.PasswordInput(render_value=True), required=True, label=target_password_label, initial=target_password) form.fields['TARGET_IP'] = target_ip_field form.fields['TARGET_USERNAME'] = target_username_field form.fields['TARGET_PASSWORD'] = target_password_field else: self.title = 'PAN-OS XML Configuration to Validate' self.help_text = 'This form allows you to paste in a full configuration from a PAN-OS NGFW. This ' \ 'will then be used to perform the validation.' label = 'Configuration' initial = self.get_value_from_workflow('config', '<xml></xml>') help_text = 'Paste the full XML configuration file to validate here.' config_field = fields.CharField(label=label, initial=initial, required=True, help_text=help_text, widget=widgets.Textarea(attrs={'cols': 40})) form.fields['config'] = config_field return form