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
Close
Hashes for django-modelmultivalue-0.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ceeb8715b4f203f8d978bbe429021babaf91597bef63763169e4756ccd1ad37 |
|
MD5 | 1e073c0b1b100c749367aa0f8a2730cd |
|
BLAKE2b-256 | f58c0ac0c1c701adce381d066a9c1926c982a61e96cc40b2397c6c5e2ff74c37 |