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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ab7553da83a76f180424f12cfe4b15959344dd59735049dc4225cba5acc0ade |
|
MD5 | 12ac1b9ef16491b358e2e09adaee9b5f |
|
BLAKE2b-256 | 364a720c41802c95b4edf84197ce8a766a718ec4cb611b1f0d43f71717f5af72 |
Close
Hashes for django_composite_field-0.7.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33e443cc9bc7f0d74ad644d8ee7664733c23d76cebacac12c7fce5d901016d62 |
|
MD5 | 92684e900aa981941531298c19423349 |
|
BLAKE2b-256 | afab9f06cfb0bf3fe136b929f4fac176c019316cec3772031d6d402186ec6ffb |