Pull random records using Django ORM.
Project description
Pull random records using Django ORM.
Requirements
Python 2.7, 3.6, 3.7
Django 1.11, 2.0, 2.1, 2.2.
Postgres
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()
# ...
Use it:
queryset = Model.objects.filter(field=value)
queryset.random() # to get one random record
queryset.random(5) # pass amount to get more records
queryset.random().values() # other queryset methods available
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
Close
Hashes for django-random-queryset-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 800be1e29efd7852bddef9de9f3419b2f93336f2a4a669694124bb3491ccd4fd |
|
MD5 | be313fc4eff3f07e6882dc08e1edb5aa |
|
BLAKE2b-256 | 7b8cf7a3d4ed347d535bced116335df7c29cf4393315c9aa5bfe8fefc5d1c409 |