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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16d280e790f560907ba3168e131ea618eb845df3114ab5b4280c941aaa9e4442 |
|
MD5 | d78de1b8411c48dba8b6e580c5af94b2 |
|
BLAKE2b-256 | 3ff8d54a81ab07e580bfb31fa12f4dcae921cb109dc9936dc3d91cc40cee026b |
Close
Hashes for django_composite_field-0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a27e4502bd3bd91e00b54b955698eb8f2d4c6ad326d3b7978a3a35e36b2d148 |
|
MD5 | 5ab6e35a7535be7583a0461509a7bb36 |
|
BLAKE2b-256 | 44d48ac8154f0a43390e2967723ee8bf2ad9e99818d574146b31d2da0a62bf3a |