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.5.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8652a741cf01c139ca12d58080569917cc17ca213cbcedfe67dec5a3abf06a7a |
|
MD5 | eb547392973e0f20e226586666b6144c |
|
BLAKE2b-256 | f0e9251098134d992883dd0e50fb04e733511238be998c0dea816a770e8975ee |
Close
Hashes for django_composite_field-0.5.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba2bdf99dc7e49ae678f3f06ab48a3f27fb8749548691e42b2d9c3d383b823d7 |
|
MD5 | c57df6cfece8d0becb18145fd976ccb4 |
|
BLAKE2b-256 | e1e7aad45646160fb4eddfe302307517c1fa8921d63e30cf27df27bf00c6906b |