我们从Python开源项目中,提取了以下31个代码示例,用于说明如何使用django.forms.widgets.Textarea()。
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)
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" })
def __init__(self, attrs=None): super(Textarea, self).__init__(attrs)
def test_formfield_can_overwrite_widget(self): field = fields.DraftailTextField() formfield = field.formfield(widget=djwidgets.Textarea) self.assertIsInstance(formfield.widget, djwidgets.Textarea)