Arbitrary django model joining
Project description
Usage:
```python
from django.db import models
from django_joining import JoiningKey
class ModelA(models.Model):
foo = models.IntegerField()
bar = models.IntegerField()
baz = models.TextField()
model_b = JoiningKey('ModelB',
from_fields=['foo', 'bar'],
to_fields=['qux', 'quux'],
related_name='model_a_set'
)
class ModelB(models.Model):
qux = models.IntegerField()
quux = models.IntegerField()
quuux = models.TextField()
ModelA.objects.filter(model_b__quuux='test').select_related('model_b')
...
ModelB.objects.prefetch_related('model_a_set')
...
```
```python
from django.db import models
from django_joining import JoiningKey
class ModelA(models.Model):
foo = models.IntegerField()
bar = models.IntegerField()
baz = models.TextField()
model_b = JoiningKey('ModelB',
from_fields=['foo', 'bar'],
to_fields=['qux', 'quux'],
related_name='model_a_set'
)
class ModelB(models.Model):
qux = models.IntegerField()
quux = models.IntegerField()
quuux = models.TextField()
ModelA.objects.filter(model_b__quuux='test').select_related('model_b')
...
ModelB.objects.prefetch_related('model_a_set')
...
```
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file django_joining-0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: django_joining-0.3-py2.py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fd1c653f8efa92cc0e894457e1f776314ed43b97bc081874f57410b2efa0c99 |
|
MD5 | dc4e713649d49aba1fbba79f318a70a1 |
|
BLAKE2b-256 | c51e71518107160123ecf785c67d5baa241f6b7e2933b6cae87a97d9bcc6dc52 |