本文整理汇总了Python中django.contrib.auth.forms.ReadOnlyPasswordHashWidget.render方法的典型用法代码示例。如果您正苦于以下问题:Python ReadOnlyPasswordHashWidget.render方法的具体用法?Python ReadOnlyPasswordHashWidget.render怎么用?Python ReadOnlyPasswordHashWidget.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.auth.forms.ReadOnlyPasswordHashWidget
的用法示例。
在下文中一共展示了ReadOnlyPasswordHashWidget.render方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_render
# 需要导入模块: from django.contrib.auth.forms import ReadOnlyPasswordHashWidget [as 别名]
# 或者: from django.contrib.auth.forms.ReadOnlyPasswordHashWidget import render [as 别名]
def test_render(self):
widget = ReadOnlyPasswordHashWidget()
value = 'pbkdf2_sha256$100000$a6Pucb1qSFcD$WmCkn9Hqidj48NVe5x0FEM6A9YiOqQcl/83m2Z5udm0='
self.assertHTMLEqual(
widget.render('name', value, {'id': 'id_password'}),
"""
<div id="id_password">
<strong>algorithm</strong>: pbkdf2_sha256
<strong>iterations</strong>: 100000
<strong>salt</strong>: a6Pucb******
<strong>hash</strong>: WmCkn9**************************************
</div>
"""
)
示例2: test_bug_19349_render_with_none_value
# 需要导入模块: from django.contrib.auth.forms import ReadOnlyPasswordHashWidget [as 别名]
# 或者: from django.contrib.auth.forms.ReadOnlyPasswordHashWidget import render [as 别名]
def test_bug_19349_render_with_none_value(self):
# Rendering the widget with value set to None
# mustn't raise an exception.
widget = ReadOnlyPasswordHashWidget()
html = widget.render(name='password', value=None, attrs={})
self.assertIn(_("No password set."), html)