Skip to main content

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

  1. Add 'specifications' to INSTALLED_APPS.

  2. 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.

  3. 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']
  4. Inherit from FormWithSpecification when creating your ModelForm:

    from specifications.forms import FormWithSpecification
    
    class MyObjectForm(FormWithSpecification):
        class Meta:
            model = MyObject
  5. 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

django-specifications-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

File details

Details for the file django-specifications-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django-specifications-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e84a1490c3b4603f40ce3e2161e89c4a9723e3b69b111f9053e73eba56a61fc3
MD5 ff68394e2f5d20665010d0afb24dac33
BLAKE2b-256 84ee42318418a521f3343c44fc6fa0b1ad00b387ecb58e47ef4f186f553027f7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page