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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 240b8fd336188d2fd7b07faa6dd42ddc2e3125bf312c31001e41b641963f5a1a |
|
MD5 | 32fa3d96a5f2bb97601932d71c661572 |
|
BLAKE2b-256 | 4eee49e004acea212ef312306ce391fd06a0a813f9c029d6821570a5d9167d1f |
Close
Hashes for django_composite_field-0.7.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 431af1bf4e4aa2c141153aed088be965223aa9c8349c76d2d1e283cad9eb574a |
|
MD5 | 0e94535caedb48e5ebfb6db73f0801cd |
|
BLAKE2b-256 | 2b027b6574a92db4f523fa9458da14e34db9024555f39a75fdb65d9b3d34ae09 |