python类TextInput()的实例源码

boundfield.py 文件源码 项目:gmail_scanner 作者: brandonhub 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
boundfield.py 文件源码 项目:djanoDoc 作者: JustinChavez 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
boundfield.py 文件源码 项目:CSCE482-WordcloudPlus 作者: ggaytan00 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
forms.py 文件源码 项目:tissuelab 作者: VirtualPlants 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
boundfield.py 文件源码 项目:producthunt 作者: davidgengler 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
boundfield.py 文件源码 项目:django-rtc 作者: scifiswapnil 项目源码 文件源码 阅读 46 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
forms.py 文件源码 项目:geekpoint 作者: Lujinghu 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
boundfield.py 文件源码 项目:django-next-train 作者: bitpixdigital 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
boundfield.py 文件源码 项目:LatinSounds_AppEnviaMail 作者: G3ek-aR 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
test_config_forms.py 文件源码 项目:maas 作者: maas 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_DictCharWidget_id_for_label_uses_first_fields_name(self):
        names = [factory.make_string()]
        initials = []
        labels = [factory.make_string()]
        widget = DictCharWidget(
            [widgets.TextInput, widgets.TextInput], names, initials, labels)
        self.assertEqual(
            ' _%s' % names[0],
            widget.id_for_label(' '))
test_config_forms.py 文件源码 项目:maas 作者: maas 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_DictCharWidget_renders_with_initial_when_no_value(self):
        """Widgets should use initial value if rendered without value."""
        names = [factory.make_name()]
        initials = [factory.make_name()]
        labels = [factory.make_name()]
        mock_widget = Mock()
        mock_widget.configure_mock(**{"render.return_value": ""})
        widget = DictCharWidget([mock_widget, widgets.TextInput],
                                names, initials, labels, skip_check=True)
        widget.render('foo', [])

        self.assertThat(
            mock_widget.render, MockCalledOnceWith(ANY, initials[0], ANY))
boundfield.py 文件源码 项目:DjangoZeroToHero 作者: RayParra 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
boundfield.py 文件源码 项目:Roboism 作者: markroxor 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
forms.py 文件源码 项目:django-wechat-api 作者: crazy-canux 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def as_text(self, attrs=None, **kwargs):
        """
        Returns a string of HTML for representing this as an <input type="text">.
        """
        return self.as_widget(TextInput(), attrs, **kwargs)
widgets.py 文件源码 项目:adhocracy4 作者: liqd 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def render(self, name, value, attrs=None):
        html_id = attrs and attrs.get('id', name) or name
        has_image_set = self.is_initial(value)
        is_required = self.is_required

        file_placeholder = ugettext('Select a picture from your local folder.')
        file_input = super().render(name, None, {
            'id': html_id,
            'class': 'form-control form-control-file'
        })

        if has_image_set:
            file_name = basename(value.name)
            file_url = conditional_escape(value.url)
        else:
            file_name = ""
            file_url = ""

        text_input = widgets.TextInput().render('__noname__', file_name, {
            'class': 'form-control form-control-file-dummy',
            'placeholder': file_placeholder,
            'tabindex': '-1',
            'id': 'text-{}'.format(html_id)
        })

        checkbox_id = self.clear_checkbox_id(name)
        checkbox_name = self.clear_checkbox_name(name)
        checkbox_input = widgets.CheckboxInput().render(checkbox_name, False, {
            'id': checkbox_id,
            'class': 'clear-image',
            'data-upload-clear': html_id,
        })

        context = {
            'id': html_id,
            'has_image_set': has_image_set,
            'is_required': is_required,
            'file_url': file_url,
            'file_input': file_input,
            'file_id': html_id + '-file',
            'text_input': text_input,
            'checkbox_input': checkbox_input,
            'checkbox_id': checkbox_id
        }

        return loader.render_to_string(
            'a4images/image_upload_widget.html',
            context
        )
widgets.py 文件源码 项目:a4-opin 作者: liqd 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def render(self, name, value, attrs=None):
        has_file_set = self.is_initial(value)
        is_required = self.is_required

        file_placeholder = ugettext('Select a file from your local folder.')
        file_input = super().render(name, None, {
            'id': name,
            'class': 'form-control form-control-file'
        })

        if has_file_set:
            file_name = basename(value.name)
            file_url = conditional_escape(value.url)
        else:
            file_name = ""
            file_url = ""

        text_input = widgets.TextInput().render('__noname__', file_name, {
            'class': 'form-control form-control-file-dummy',
            'placeholder': file_placeholder
        })

        checkbox_id = self.clear_checkbox_id(name)
        checkbox_name = self.clear_checkbox_name(name)
        checkbox_input = widgets.CheckboxInput().render(checkbox_name, False, {
            'id': checkbox_id,
            'class': 'clear-image',
            'data-upload-clear': name,
        })

        context = {
            'name': name,
            'has_image_set': has_file_set,
            'is_required': is_required,
            'file_url': file_url,
            'file_input': file_input,
            'file_id': name + '-file',
            'text_input': text_input,
            'checkbox_input': checkbox_input,
            'checkbox_id': checkbox_id
        }

        return mark_safe(
            loader.render_to_string(
                'euth_offlinephases/file_upload_widget.html',
                context
            )
        )


问题


面经


文章

微信
公众号

扫码关注公众号