django-random-queryset


Namedjango-random-queryset JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttp://github.com/rremizov/django-random-queryset
SummaryPull random records using Django ORM.
upload_time2023-11-03 08:42:41
maintainer
docs_urlNone
authorRoman Remizov
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            django-random-queryset
======================

Pull random records using Django ORM.


Requirements
------------

- Python 3.8+
- Django 3.2+


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()

        # ...
        

**No database migrations are needed.**


How to use it:

.. code:: python

    queryset = Model.objects.filter(field=value)
    queryset.random()   # to get one random record
    queryset.random(5)  # to pass limited random records
    queryset.random(len(queryset)) # to get all random records
    queryset.random().values()  # to have access to other queryset methods 



            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/rremizov/django-random-queryset",
    "name": "django-random-queryset",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Roman Remizov",
    "author_email": "rremizov@yandex.ru",
    "download_url": "https://files.pythonhosted.org/packages/47/75/114ce2951f731a887bda5a0e125b7b100481d86944fd6eb1ee5d764241d5/django-random-queryset-0.2.0.tar.gz",
    "platform": "any",
    "description": "django-random-queryset\n======================\n\nPull random records using Django ORM.\n\n\nRequirements\n------------\n\n- Python 3.8+\n- Django 3.2+\n\n\nInstallation\n------------\n\n.. code:: sh\n\n    $ pip install django-random-queryset\n\n\nSetup\n-----\n\n\nAdd ``RandomManager`` to desired model:\n\n.. code:: python\n\n    from django.db import models\n\n    from django_random_queryset import RandomManager\n\n\n    class Model(models.Model):\n\n        objects = RandomManager()\n\n        # ...\n        \n\n**No database migrations are needed.**\n\n\nHow to use it:\n\n.. code:: python\n\n    queryset = Model.objects.filter(field=value)\n    queryset.random()   # to get one random record\n    queryset.random(5)  # to pass limited random records\n    queryset.random(len(queryset)) # to get all random records\n    queryset.random().values()  # to have access to other queryset methods \n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pull random records using Django ORM.",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "http://github.com/rremizov/django-random-queryset"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4775114ce2951f731a887bda5a0e125b7b100481d86944fd6eb1ee5d764241d5",
                "md5": "f7fbf124fe020b92e44c6c1c7eff9ce6",
                "sha256": "bf7c28877acb373c2e37279eb2a850261ca7dc37ba1dbb2e32650509512946e6"
            },
            "downloads": -1,
            "filename": "django-random-queryset-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f7fbf124fe020b92e44c6c1c7eff9ce6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3611,
            "upload_time": "2023-11-03T08:42:41",
            "upload_time_iso_8601": "2023-11-03T08:42:41.342875Z",
            "url": "https://files.pythonhosted.org/packages/47/75/114ce2951f731a887bda5a0e125b7b100481d86944fd6eb1ee5d764241d5/django-random-queryset-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-03 08:42:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rremizov",
    "github_project": "django-random-queryset",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-random-queryset"
}
        
Elapsed time: 0.16571s