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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 586c4b95d730be0458aabc14ac2aab473ef2ae8fda8213d0193c872af5245422 |
|
MD5 | e490ff59d51316e958da744de8ba4daf |
|
BLAKE2b-256 | d8c0c8194d7e655cfaa43273f73ab38d2708d83dac6b3e752dfa6200c79fdce9 |
Close
Hashes for django_composite_field-0.7.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3830b5a74739a8db0f060d16cf32356112768a3bdfb6c604f7ae5c2de12d7813 |
|
MD5 | f37e102171eb9dfcc22316ff03cb414b |
|
BLAKE2b-256 | b70c4b7001cb10321352ceb06295a4ca0de40b3f7e34a762dca6680a59dfd79f |