Skip to main content
Help us improve Python packaging – donate today!

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.

Release history Release notifications

This version
History Node

0.2.0

History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-specifications-0.2.0.tar.gz (10.2 kB) Copy SHA256 hash SHA256 Source None Oct 6, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page