Django的互斥表单字段假发
django-xor-formfields的Python项目详细描述
#互斥表单域
[![构建状态](https://travis-ci.org/dschep/django-xor-formfields.svg?(https://travis ci.org/dschep/django-xor form fields/django-xor-formfields)
>方便地将互斥字段添加到django表单中。
/>```
示例互斥表单字段(textinput&;选择:
```
通过小部件推断
mutuallyexclusivevaluefield(
fields=(forms.typedchoicefield(choices=[(1,1),(2,2)),converte=int),
forms.integerfield())
手动创建小部件(允许占位符attr&;其他自定义项)
mutuallyExclusiveValueField(
Fields=(forms.integerField(),forms.integerField()),
widget=mutuallyExclusiveRadioWidget(widgets=[
forms.select(choices=[(1,1),(2,2)],
forms.textInput(attrs={'placeholder':'enta number}),
])
```
该字段接受接受以下值的“to”参数:
“none”、“url”、“file”。该值使字段执行no
规范化,规范化为URL(将上载的文件存储为媒体)或
为文件(将URL下载到“inMemoryUploadedFile”)。
upload_to=“foobar”)始终验证URL
```
AWS注意:
“fileorurlfield”支持一个they关键字参数“no_aws_qs”,如果通过“django storages”使用AWS,则禁用AWS查询授权
测试和覆盖!
要运行测试,只需运行:
```
django_settings_module=xor formfields.test_settings django-admin.py test xorformfields
```
覆盖率结果可从以下网址获得:https://dschep.github.io/django-xor-formfields/htmlcov/
[![构建状态](https://travis-ci.org/dschep/django-xor-formfields.svg?(https://travis ci.org/dschep/django-xor form fields/django-xor-formfields)
>方便地将互斥字段添加到django表单中。
/>```
示例互斥表单字段(textinput&;选择:
```
通过小部件推断
mutuallyexclusivevaluefield(
fields=(forms.typedchoicefield(choices=[(1,1),(2,2)),converte=int),
forms.integerfield())
手动创建小部件(允许占位符attr&;其他自定义项)
mutuallyExclusiveValueField(
Fields=(forms.integerField(),forms.integerField()),
widget=mutuallyExclusiveRadioWidget(widgets=[
forms.select(choices=[(1,1),(2,2)],
forms.textInput(attrs={'placeholder':'enta number}),
])
```
该字段接受接受以下值的“to”参数:
“none”、“url”、“file”。该值使字段执行no
规范化,规范化为URL(将上载的文件存储为媒体)或
为文件(将URL下载到“inMemoryUploadedFile”)。
upload_to=“foobar”)始终验证URL
```
AWS注意:
“fileorurlfield”支持一个they关键字参数“no_aws_qs”,如果通过“django storages”使用AWS,则禁用AWS查询授权
测试和覆盖!
要运行测试,只需运行:
```
django_settings_module=xor formfields.test_settings django-admin.py test xorformfields
```
覆盖率结果可从以下网址获得:https://dschep.github.io/django-xor-formfields/htmlcov/