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 specification = 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.2.0.tar.gz
.
File metadata
- Download URL: django-specifications-0.2.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29c0182053e7cf9f45c8677e61b42c67ea539992284212f809f46ab59667f8cd |
|
MD5 | ff2036d5ee9956927a91437052c55d27 |
|
BLAKE2b-256 | 422d4e803e5b48ef874d804ca37db71b9f06b4713a0a22f1bcdd5d56c183e3d6 |