django-dictionaryfield-1.0
توضیحات
Dynamic list of inputs
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | django-dictionaryfield-1.0 |
| نام | django-dictionaryfield |
| نسخه کتابخانه | 1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | misiurev@ncbi.nlm.nih.gov |
| آدرس صفحه اصلی | https://bitbucket.ncbi.nlm.nih.gov/projects/PMC/repos/django-dictionaryfield/browse |
| آدرس اینترنتی | https://pypi.org/project/django-dictionaryfield/ |
| مجوز | Public Domain |
# Wrapper for [jsonfield](https://github.com/bradjasper/django-jsonfield) with predefined structurethat uses set of corresponding widgets for edit
Requires Django 1.8+
## Installation
```
pip install django-dictionaryfield
```
## Usage
Add "dictionaryfield" to installed apps in django settings file:
```python
INSTALLED_APPS = (
...
'dictionaryfield',
...
)
```
### Use as model field
```python
from collections import OrderedDict
from django.db import models
from dictionaryfield import DictionaryField
class MyModel(models.Model):
english_data = DictionaryField(
"What is the first volume and issue in which the journal published full-text English?",
fields=OrderedDict([
('volume', fields.CharField(label='Volume', required=False)),
('issue', fields.CharField(label='Issue', required=False))
])
)
```
### Use as form field
```python
from collections import OrderedDict
from django.db import models
from dictionaryfield import DictionaryFormField
class MyForm(models.Model):
sample_field = DictionaryFormField(
"Sample field label",
fields=OrderedDict([
('volume', fields.CharField(label='Volume', required=False)),
('issue', fields.CharField(label='Issue', required=False))
])
)
```
### Use with bootstrap3 template tags
Dictionary field works with django-bootstrap3. In a template your should access child fields like this:
```html
{% load bootstra3 %}
{% bootstrap_field form.sample_field.volume %}
{% bootstrap_field form.sample_field.issue %}
```
نحوه نصب
نصب پکیج whl django-dictionaryfield-1.0:
pip install django-dictionaryfield-1.0.whl
نصب پکیج tar.gz django-dictionaryfield-1.0:
pip install django-dictionaryfield-1.0.tar.gz