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.7.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97b3144e132fefd7a6800f7cb78dab460a2a47ea265105d46dc01ecaea465b29 |
|
MD5 | 1670398f3e8ef531bb7381e95c9af02b |
|
BLAKE2b-256 | ad8cdb9ec239c771a5166dfcc5803587e8a02c50e554494be58bd91441675068 |
Close
Hashes for django_composite_field-0.7.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5234694097ddc0ca4596a463dfa700b37fc31cd8c1d1e5b27689be171e45cdb2 |
|
MD5 | c22213dcf0b128232cc1540c591738fe |
|
BLAKE2b-256 | 937686fb44edbcde34b314b0efef1e5ba3f903f74292be798f6a70e027c6fc03 |