A form field to create a related model sub-form
Project description
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=ForeignKey
for 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 }
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-modelmultivalue-0.21.tar.gz
.
File metadata
- Download URL: django-modelmultivalue-0.21.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
aa4f3bd50c0cc6a027112da8f322335781e3bab07eea9b34b3cafc84d96eef42
|
|
MD5 |
7af1ab1db6d20d81d510dd1bf62185c7
|
|
BLAKE2b-256 |
13a8c29a9fffd349aa015d49f57965333247c6a9ca1c5d42d5444d46677db81f
|