ModelMultiValueField provides the ability to create sub-forms for foreign models without having to worry about writing the ModelMultiValueField subclasses.
Quick start
Add “modelmultivalue” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'modelmultivalue', ]Add the ModelMultiValueField to a model form
All django version:
from django import forms from modelmultivalue import ModelMultiValueField class ExampleModelForm(forms.ModelForm): class Meta: model = Example fields = '__all__' ForeignKeyField = ModelMultiValueField(model=ForeignKeyfor Django>=1.9:
from django import forms from modelmultivalue import ModelMultiValueField class ExampleModelForm(forms.ModelForm): class Meta: model = Example fields = '__all__' field_classes={ 'ForeignKeyField': ModelMultiValueField }
Metadata
Release files for django-modelmultivalue 0.21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-modelmultivalue-0.21.tar.gz | 6.0 kB | Details |
Release files / django-modelmultivalue-0.21.tar.gz
| Download URL | django-modelmultivalue-0.21.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa4f3bd50c0cc6a027112da8f322335781e3bab07eea9b34b3cafc84d96eef42
|
|
BLAKE2b-256 checksum How to use checksums |
13a8c29a9fffd349aa015d49f57965333247c6a9ca1c5d42d5444d46677db81f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |