test_templatetags.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:silica 作者: zagaran 项目源码 文件源码
def test_angular_input_field(self):
        my_form = SampleForm()
        template = u'{% angular_input_field my_form.name model_name params %}'
        context = {'my_form': my_form,
                   'model_name': 'yourname',
                   'params': {}}
        # Django 1.10 changes the rendering of boolean attributes
        if VERSION[1] > 9:
            output = (u'<input class="form-control" id="id_name" '
                      u'maxlength="100" name="name" ng-model='
                      u'"yourname.fields.name" type="text" required />')
        else:
            output = (u'<input class="form-control" id="id_name" '
                      u'maxlength="100" name="name" ng-model='
                      u'"yourname.fields.name" required="true" type="text" />')
        self.tag_test(template, context, output)
        # repeat test, with bound form
        my_form = SampleForm({'name': 'Joe Bloggs'})
        self.tag_test(template, context, output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号