Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-random-queryset-0.0.3.tar.gz (3.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page