当前位置: 首页>>代码示例>>Python>>正文


Python widgets.Textarea方法代码示例

本文整理汇总了Python中django.forms.widgets.Textarea方法的典型用法代码示例。如果您正苦于以下问题:Python widgets.Textarea方法的具体用法?Python widgets.Textarea怎么用?Python widgets.Textarea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.forms.widgets的用法示例。


在下文中一共展示了widgets.Textarea方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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) 
开发者ID:nitmir,项目名称:django-cas-server,代码行数:18,代码来源:forms.py

示例2: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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 
开发者ID:sfu-fas,项目名称:coursys,代码行数:8,代码来源:code.py

示例3: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
def __init__(self, *args, **kwargs):
            super(Archive.ComponentForm, self).__init__(*args, **kwargs)
            self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5}) 
开发者ID:sfu-fas,项目名称:coursys,代码行数:5,代码来源:archive.py

示例4: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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}) 
开发者ID:sfu-fas,项目名称:coursys,代码行数:6,代码来源:livecode.py

示例5: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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}) 
开发者ID:sfu-fas,项目名称:coursys,代码行数:6,代码来源:text.py

示例6: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
def __init__(self, *args, **kwargs):
            super(Image.ComponentForm, self).__init__(*args, **kwargs)
            self.fields['description'].widget = Textarea(attrs={'cols': 50, 'rows': 5}) 
开发者ID:sfu-fas,项目名称:coursys,代码行数:5,代码来源:image.py

示例7: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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 
开发者ID:sfu-fas,项目名称:coursys,代码行数:7,代码来源:office.py

示例8: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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") 
开发者ID:sfu-fas,项目名称:coursys,代码行数:6,代码来源:word.py

示例9: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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 
开发者ID:sfu-fas,项目名称:coursys,代码行数:7,代码来源:codefile.py

示例10: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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}) 
开发者ID:sfu-fas,项目名称:coursys,代码行数:6,代码来源:url.py

示例11: as_textarea

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:5,代码来源:forms.py

示例12: as_textarea

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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) 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:5,代码来源:boundfield.py

示例13: test_widget

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
def test_widget(self):
        """The default widget of a JSONField is a Textarea."""
        field = forms.JSONField()
        self.assertIsInstance(field.widget, widgets.Textarea) 
开发者ID:nesdis,项目名称:djongo,代码行数:6,代码来源:test_json.py

示例14: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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"
        }) 
开发者ID:wise-team,项目名称:steemprojects.com,代码行数:14,代码来源:forms.py

示例15: generate_dynamic_form

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Textarea [as 别名]
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 
开发者ID:PaloAltoNetworks,项目名称:panhandler,代码行数:50,代码来源:views.py


注:本文中的django.forms.widgets.Textarea方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。