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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60383f93d3dada608317a9d1373d0c5d6a9d35c207f897512fd75b8d905ea7dd |
|
MD5 | 1c86c89928103285d1a1725ee18d7e91 |
|
BLAKE2b-256 | 2234869faa5fd895261ee62673252829079e966d6eb534e00a02eb6a0b1cccec |
Close
Hashes for django_composite_field-0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96e88744a80bc662da082a43a6e3108cd0e91ae6ed95503cfc27c85fa86cfa91 |
|
MD5 | 941eab723d6b0e4e1da18592b683d0ea |
|
BLAKE2b-256 | c4dc2033b2e42afa9cb2c94b04f8dad9b81dd0805625d2e5a0e434638004b980 |