CompositeField implementation for Django
Project description
This is an implementation of a CompositeField for Django. Composite fields can be used to group fields together and reuse their definitions.
Example:
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 objekt also makes it possible to assign more than one property at once.
There are some more examples in the included tests.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-composite-field-0.6.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04de507cd2c439b373e646e23ed2159c2f844a17c1820cd41d988df78ec443ab |
|
MD5 | 798c7761143ba2c9722e77f66aef7562 |
|
BLAKE2b-256 | 2cac228958276e454d665cb2d0572fd3ceb45fec967a5ab6988440c3e082895d |
Close
Hashes for django_composite_field-0.6.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e858aa2f39d5c3041484c36a6667ed18358f9dda78670ed7b9b52da250087887 |
|
MD5 | cca3a67ce9bd0ab77fe56fe1eb114e9f |
|
BLAKE2b-256 | c31477e15ee3c7addadec8d3ce3828dd9b0eeed4747e3aed70aefb19eac9161d |