Metadata-Version: 2.0
Name: django-composite-field
Version: 0.9.0
Summary: CompositeField implementation for Django
Home-page: http://bitbucket.org/bikeshedder/django-composite-field
Author: Michael P. Jung
Author-email: michael.jung@terreon.de
License: BSD
Keywords: django composite field
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries :: Python Modules

CompositeField for Django Models
================================

This is an implementation of a CompositeField for Django. Composite fields
can be used to group fields together and reuse their definitions.

Example:

.. code-block:: python

    class CoordField(CompositeField):
        x = models.FloatField()
        y = models.FloatField()

    class Place(models.Model):
        name = models.CharField(max_length=10)
        coord = CoordField()

    p = Place(name='Foo', coord_x=42, coord_y=0)
    q = Place(name='Foo', coord=p.coord)
    q.coord.y = 42

The content of composite fields are stored inside the model, so they do
not have to fiddle with any internals of the Django models. For example
``p.coord`` returns a proxy object that maps the fields ``x`` and ``y``
to the model fields ``coord_x`` and ``coord_y``. The proxy object also
makes it possible to assign more than one property at once.

There are some more examples in the included tests.py.


