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 specification = 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.2.0.tar.gz (10.2 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for django-specifications-0.2.0.tar.gz
Algorithm Hash digest
SHA256 29c0182053e7cf9f45c8677e61b42c67ea539992284212f809f46ab59667f8cd
MD5 ff2036d5ee9956927a91437052c55d27
BLAKE2b-256 422d4e803e5b48ef874d804ca37db71b9f06b4713a0a22f1bcdd5d56c183e3d6

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