CompositeField implementation for Django
Project description
CompositeField for Django Models
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
How does it work?
The content of composite fields are stored inside the model, so they do
not have to fiddle with any internals of the Django models. In the example
above 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.
Documentation can be found at RTFD.
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-2.0.0.tar.gz
.
File metadata
- Download URL: django_composite_field-2.0.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-92-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bdf9b4952ccdeac04908f6895e0d7ac345188934edf75b3dec0d50696397a21 |
|
MD5 | 5ea0cc35ef9e690b89b498fbfff1013a |
|
BLAKE2b-256 | 520dfad7a219ff19c9a8d6255b808f7c86b06ef93ca22181f7694c67a5e76197 |
File details
Details for the file django_composite_field-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: django_composite_field-2.0.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-92-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d742452824bc153c9f273e86f121f688920cc91905ff5d150c121433872e617 |
|
MD5 | 5134fd90db9775b885e1e1807e24d9e3 |
|
BLAKE2b-256 | f7eef180c3c0d280c543231bd9bdefd5c7f2bdb30c02f0210db9330f6c1685f8 |