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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00a7bde19a74a1ac2dc56907cbf2d7d65af2e13a60f790335342a813b7ddc4c8 |
|
MD5 | 145d3aceb1ff9c705efae207b23fa40c |
|
BLAKE2b-256 | 4c45439ac8c0bdbdda78c8d6f8f701b73f1ad45114f1d1ef48ca2bbacf614348 |
Close
Hashes for django_composite_field-0.7.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cec7cca9fc6e85034d38f7a580c1c40769286b3ce393082b1186d79e82e8530a |
|
MD5 | bd076fba5ce5310dc42411fd32478486 |
|
BLAKE2b-256 | 7d0375d8b127dfc21494944fed42324e2233e2df5f6fa63f6d1f6a395b88b98c |