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
File details
Details for the file django-composite-field-0.2.tar.gz
.
File metadata
- Download URL: django-composite-field-0.2.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bec69bbb85a1fe1d9465b20a30ff3bf25329128ff6b538f303fa96ee4237c1b |
|
MD5 | 370ce19cb4f7f38e768bb9f6081e6e17 |
|
BLAKE2b-256 | ddccd794b5456c2aef5cae80ac549f525e6143d67adcd384cd5d381a78279715 |
File details
Details for the file django_composite_field-0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: django_composite_field-0.2-py2.py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a06f0ca9e3515915d181babd14c16d00127352506267e7be89a992b44f3fca9e |
|
MD5 | a3fe396c64475131474a4dd44460dc7b |
|
BLAKE2b-256 | 5479b1d4de61065a35284d4829b6cc52a0d50ae3bcbef8e4b613fb9938842770 |