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 object 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.8.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2919b3266c2c7b495c6dd4f726261e4cc1e6f4223943636be4dedb1eda1b7f8f |
|
MD5 | e520dc5ceb573589d13a77a5de6a7245 |
|
BLAKE2b-256 | 77218b4376c73bbff2e9ffce2642ed5508194812bca7d91f11a883c4218387cc |
Close
Hashes for django_composite_field-0.8.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88d20934fccdb433dc508559edca8efb6e52e0b7495757170dd6e8ee84a6f3b1 |
|
MD5 | 6cbedf72e859514301a7b730540c1e23 |
|
BLAKE2b-256 | 402e18c047777bcecdd25a8289740901501a7b497fe8793290894233afc9d867 |