Metadata-Version: 2.1
Name: django-composite-field
Version: 1.0.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
Description-Content-Type: UNKNOWN
Keywords: django composite field
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.8
Classifier: Framework :: Django :: 1.9
Classifier: Framework :: Django :: 1.10
Classifier: Framework :: Django :: 1.11
Classifier: Framework :: Django :: 2.0
Classifier: Framework :: Django :: 2.1
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules

|Build Status| |PyPI Version| |PyPI License| |Python Versions| |Django Versions| |Read the Docs|

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


How does it work?
-----------------

The content of composite fields are stored inside the model, so they do
not have to fiddle with any internals of the Django models. In the example
above ``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.

.. |Build Status| image:: http://img.shields.io/travis/ninemoreminutes/django-crum.svg
   :target: https://travis-ci.org/ninemoreminutes/django-crum
.. |PyPI Version| image:: https://img.shields.io/pypi/v/django-composite-field.svg
   :target: https://pypi.python.org/pypi/django-composite-field/
.. |PyPI License| image:: https://img.shields.io/pypi/l/django-composite-field.svg
   :target: https://pypi.python.org/pypi/django-composite-field/
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/django-composite-field.svg
   :target: https://pypi.python.org/pypi/django-composite-field/
.. |Django Versions| image:: https://img.shields.io/pypi/djversions/django-composite-field.svg
   :target: https://pypi.org/project/django-composite-field/
.. |Read the Docs| image:: https://img.shields.io/readthedocs/django-composite-field.svg
   :target: http://django-composite-field.readthedocs.io/



