Pull random records using Django ORM.
Project description
Pull random records using Django ORM.
Requirements
Python 3.10+
Django 4.2+
Installation
$ pip install django-random-queryset
Setup
Add RandomManager to desired model:
from django.db import models
from django_random_queryset import RandomManager
class Model(models.Model):
objects = RandomManager()
# ...
No database migrations are needed.
How to use it:
queryset = Model.objects.filter(field=value)
queryset.random() # to get one random record
queryset.random(5) # to get 5 random records
queryset.random(len(queryset)) # to get all random records
queryset.random().values() # to have access to other queryset methods
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_random_queryset-0.3.1.tar.gz.
File metadata
- Download URL: django_random_queryset-0.3.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
278123c82c77ade1f16d5620ef26f1a1efda18b8c60cd70296d9025bbe357dfe
|
|
| MD5 |
33cda77e428ac3550bfd5f2b5e0e5ef1
|
|
| BLAKE2b-256 |
154137c8713b41407089d4f2039b862101fce7f153315b94960aaaf0d9f9c8f5
|
Provenance
The following attestation bundles were made for django_random_queryset-0.3.1.tar.gz:
Publisher:
publish.yml on rremizov/django-random-queryset
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_random_queryset-0.3.1.tar.gz -
Subject digest:
278123c82c77ade1f16d5620ef26f1a1efda18b8c60cd70296d9025bbe357dfe - Sigstore transparency entry: 1198006442
- Sigstore integration time:
-
Permalink:
rremizov/django-random-queryset@9d631402b5a29a0eb7410ba4a65eb7787135253f -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/rremizov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d631402b5a29a0eb7410ba4a65eb7787135253f -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_random_queryset-0.3.1-py3-none-any.whl.
File metadata
- Download URL: django_random_queryset-0.3.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06b3a24164ccf8f17c1aab4c7c88a4e024880bda0e3028a69aece283e6dcca17
|
|
| MD5 |
db12d52665c259f899a7495ca9bce0be
|
|
| BLAKE2b-256 |
531d9a14ff25fc63dd5145367a1ef7b2927c47b256e66d5808f497619d245f93
|
Provenance
The following attestation bundles were made for django_random_queryset-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on rremizov/django-random-queryset
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_random_queryset-0.3.1-py3-none-any.whl -
Subject digest:
06b3a24164ccf8f17c1aab4c7c88a4e024880bda0e3028a69aece283e6dcca17 - Sigstore transparency entry: 1198006582
- Sigstore integration time:
-
Permalink:
rremizov/django-random-queryset@9d631402b5a29a0eb7410ba4a65eb7787135253f -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/rremizov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d631402b5a29a0eb7410ba4a65eb7787135253f -
Trigger Event:
push
-
Statement type: