Django Custard

Django runtime typed custom fields

Django Custard is a small reusable unobtrusive Django app that implements runtime custom fields that can be attached to any model on the fly: it’s possible to create fields and set values for them from the code or manage them through the admin site, with the ability to display them even outside of the admin.

Pypi latest version Build Status - master branch Source code coverage - master branch Pypi downloads Supported Python versions License

Getting started

  1. You can get Django Custard by using pip:

    pip install django-custard
    
  2. You will need to add the 'custard' application to the INSTALLED_APPS setting of your Django project settings.py file.:

    INSTALLED_APPS = (
        ...
    
        'custard',
    )
    
  3. In a models.py file in your app you should just add the 2 models responsible of holding the custom fields type and values.:

    from custard.builder import CustomFieldsBuilder
    
    builder = CustomFieldsBuilder('myapp.CustomFieldsModel', 'myapp.CustomValuesModel')
    
    ...
    
    class CustomFieldsModel(builder.create_fields()):
        pass
    
    class CustomValuesModel(builder.create_values()):
        pass
    

Customization

Configuration

Customize Django Custard with some CUSTOM_* configuration variables in a Django project settings.py file.

Models

How to work with Django Custard models and helper classes.

Admin

Process of integrating Django Custard in admin.

Support

Changelog

Only important changes are mentioned below.

v0.7 (2014-07-29)

  • Moved away from the static custard.models.custom class in favour of custard.builder
  • Enable search of custom fields in admin without hacks
  • Simplified a bit how to determine the classes in the builder
  • Updated tests and example to the new builder methods

v0.6 (2014-07-27)

  • Added support for python 2.6/2.7/3.2 and django 1.5/1.6
  • Added test cases for forms and widgets
  • Improved settings class to be cached at runtime while being able to work with override_settings in tests
  • Fixed documentation links and sections not showing up

v0.5 (2014-07-23)

  • Removed useless custom Exception classes not used anymore
  • Added model mixin creation class for holding additional helper functions
  • Fixed broken links in docs
  • Added manager subclass to docs
  • Added admin to docs

v0.4 (2014-07-23)

  • Moved generation of FormField from model to Form
  • Improved documentation

v0.3 (2014-07-22)

  • Improved documentation

v0.2 (2014-07-20)

  • Avoid using a global registry for registered apps in favour of a setting variable
  • Improved documentation

v0.1 (2014-07-18)

  • First stable version released