Recent objects fetching utilities
Usage:
from testapp.models import Article, Comment, Payment
from recent_objects.recent_objects import RecentObjects
ro = RecentObjects(
[
{
"queryset": Article.objects.all(),
"date_field": "created_at",
# "type": "testapp.article",
},
{
"queryset": Comment.objects.all(),
"date_field": "created_at",
# "type": "testapp.comment",
},
{
"queryset": Payment.objects.all(),
"date_field": "created_at",
# "type": "testapp.payment",
},
]
)
recent_10_objects = ro.page(paginate_by=10, page=1)
recent_10_objects will now be a list of up to 10 dictionaries of the form:
[
{
"type": "testapp.article",
"date": datetime(...),
"pk": 24,
"object": Article(),
},
{
"type": "testapp.comment",
"date": datetime(...),
"pk": 42,
"object": Comment(),
},
...
]
You can optionally specify the type yourself in the recent objects spec above. This may be useful when you want more control over the value or if you’re assembling several querysets using the same underlying model.
Release files for django_recent_objects 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_recent_objects-0.1.1.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_recent_objects-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / django_recent_objects-0.1.1.tar.gz
| Download URL | django_recent_objects-0.1.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79709d5ddb9f799cbcf2348a0ca915a15b9384ff5af42216d28204ec520066c8
|
|
BLAKE2b-256 checksum How to use checksums |
3e87f097c576ec0f57bdb1175d799d7d67a25a4aa5dece1758e17c413ebb65e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Release files / django_recent_objects-0.1.1-py3-none-any.whl
| Download URL | django_recent_objects-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76f232ff8bb113c24096f0d18a9b592e4df8866c2016f2a6e4c69f2c5e1014d6
|
|
BLAKE2b-256 checksum How to use checksums |
70bb46e84613b94bf8b3b8567a7634567ad4a907f6797278eaf440c99db7db91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|