Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
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

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 Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting