The extension gives you ability to pull random records using Django's ORM.
Project description
The extension gives you ability to pull random records using Django’s ORM.
Requirements
Python 2.7, 3.2, 3.3, 3.4, Django 1.5+.
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.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7c69542a03b7630d6a85797067aa1f4c0882281efc6caddd91ea6f2abdeaa68 |
|
MD5 | a26a76ded649d5b9c4e4212c18153bce |
|
BLAKE2b-256 | a0695f27c0caf1c27cfe0194f559ca2026c44a9246b14f0425f1fba624b37797 |