The extension gives you ability to pull random records using Django's ORM.
Project description
django-random-queryset |Build status|
======================
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
------------
.. code:: sh
$ pip install django-random-queryset
Setup
-----
Add ``RandomManager`` to desired model:
.. code:: python
from django.db import models
from django_random_queryset import RandomManager
class Model(models.Model):
objects = RandomManager()
# ...
Use it:
.. code:: python
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
.. |Build status| image:: https://travis-ci.org/rremizov/django-random-queryset.svg?branch=master
:target: https://travis-ci.org/Suor/django-cacheops
======================
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
------------
.. code:: sh
$ pip install django-random-queryset
Setup
-----
Add ``RandomManager`` to desired model:
.. code:: python
from django.db import models
from django_random_queryset import RandomManager
class Model(models.Model):
objects = RandomManager()
# ...
Use it:
.. code:: python
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
.. |Build status| image:: https://travis-ci.org/rremizov/django-random-queryset.svg?branch=master
:target: https://travis-ci.org/Suor/django-cacheops
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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3caff766ee0cd0bfbf6865595c47e3f26c1a3f08bb18b85f7999a7aa1503b3f9 |
|
MD5 | a7db0325d7458dad15f78986eacd2ad8 |
|
BLAKE2b-256 | 4b54c9bfc35b30f59e29bf2988a1325188df6986dc6adf7784474c8af811701c |