Additional, dynamic fields for all Django models.
Project description
This module offers an easy way to attach auxiliary information to Django models. It allows configuring custom forms through the administration interface.
Usage
Add 'specifications' to INSTALLED_APPS.
Create a ForeignKey('specifications.Specification') on the model you want to use specifications with. The foreign key can be nullable or required, as you wish.
Create the place where the specification field data is actually stored:
from specifications.models import SpecificationValueFieldBase class MyObjectField(SpecificationValueFieldBase): parent = models.ForeignKey(MyObject, related_name='fields') class Meta: ordering = ['field__group__ordering', 'ordering']
Inherit from FormWithSpecification when creating your ModelForm:
from specifications.forms import FormWithSpecification class MyObjectForm(FormWithSpecification): class Meta: model = MyObject
There is no fifth step.
The fields are available after saving a specification. The specification can be changed, but you risk losing data if you do this.
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-specifications-0.1.0.tar.gz
.
File metadata
- Download URL: django-specifications-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e84a1490c3b4603f40ce3e2161e89c4a9723e3b69b111f9053e73eba56a61fc3 |
|
MD5 | ff68394e2f5d20665010d0afb24dac33 |
|
BLAKE2b-256 | 84ee42318418a521f3343c44fc6fa0b1ad00b387ecb58e47ef4f186f553027f7 |