动态输入列表
django-dictionaryfield的Python项目详细描述
#带有预定义结构的[jsonfield]的包装器使用一组相应的小部件进行编辑
需要django 1.8+
文件:
`` python
已安装的应用程序=(
…
'字典字段',
…
)
````
``python
《华尔街日报》在哪个期刊上发表了全文英文?”,
fields=ordereddict([
('volume',fields.charfield(label='volume',required=false)),
('issue',fields.charfield(label='issue',,required=false))
]
)
```
``python
``python
from collections import ordereddict
from django.db import models
from dictionaryfield import dictionaryformfield
class myform(models.model):
sample_field=dictionaryformfield(
“示例字段标签”,
字段=orderedict([
('volume',fields.charfield(label='volume',required=false)),
('issue',fields.charfield(label='issue',必选=false))
])
)
````
与bootstrap3模板标记一起使用字典字段与django-bootstrap3一起使用。在模板中,您应该访问如下子字段:
``html
{%load bootstra3%}
{%bootstrap_field form.sample_field.volume%}
{%bootstrap_field form.sample_field.issue%}
```
需要django 1.8+
文件:
`` python
已安装的应用程序=(
…
'字典字段',
…
)
````
``python
《华尔街日报》在哪个期刊上发表了全文英文?”,
fields=ordereddict([
('volume',fields.charfield(label='volume',required=false)),
('issue',fields.charfield(label='issue',,required=false))
]
)
```
``python
``python
from collections import ordereddict
from django.db import models
from dictionaryfield import dictionaryformfield
class myform(models.model):
sample_field=dictionaryformfield(
“示例字段标签”,
字段=orderedict([
('volume',fields.charfield(label='volume',required=false)),
('issue',fields.charfield(label='issue',必选=false))
])
)
````
与bootstrap3模板标记一起使用字典字段与django-bootstrap3一起使用。在模板中,您应该访问如下子字段:
``html
{%load bootstra3%}
{%bootstrap_field form.sample_field.volume%}
{%bootstrap_field form.sample_field.issue%}
```