{ "info": { "author": "Noah Seger", "author_email": "nosamanuel@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "dj-queryset-manager\n~~~~~~~~~~~~~~~~~~~\n\nA Django utility that makes it simple to write DRY queryset methods.\n\n\nWarning\n-------\n\ndj-queryset-manager only works with Django versions 1.2 through 1.6.\n\nIn Django 1.7 it has been superseded by ``QuerySet.as_manager()``. See `the docs `_.\n\n\nUsage\n-----\n\n1. Create a manager class that inherit the ``QuerySetManager``\n2. Decorate your filter methods with ``queryset_method``. **These methods receive a queryset instead of a manager as the first argument**.\n\n.. code:: python\n\n from dj_queryset_manager import QuerySetManager, queryset_method\n\n class MyManager(QuerySetManager):\n @queryset_method\n def by_slug(queryset, slug):\n return queryset.filter(slug=slug)\n\n @queryset_method\n def filter(queryset, *args, **kwargs):\n return super(type(queryset), queryset).filter(*args, **kwargs)\n\n\nFor reference, here is a standard implementation:\n\n.. code:: python\n\n from django.db.models import Manager\n from django.db.models.query import QuerySet\n\n class MyQuerySet(QuerySet):\n def by_slug(self, slug):\n return self.filter(slug=slug)\n\n def filter(self, *args, **kwargs):\n return super(MyQuerySet, self).filter(*args, **kwargs)\n\n\n class MyManager(Manager):\n def get_query_set(self): # Better remember the arguments to QuerySet\n QuerySet(self.model, using=self._db)\n\n def get_queryset(self): # And don't forget about Django 1.6\n return self.get_query_set()\n\n def by_slug(self, *args, **kwargs): # Enjoy this duplicate signature\n return self.get_queryset().filter(*args, **kwargs)\n\n\nMix-in\n------\n\nSome third-party apps ship managers as part of their API. If you need to extend any existing manager, use the ``QuerySetManagerMixin``. This example uses the ``InheritanceManager`` from `django-model-utils `_.\n\n.. code:: python\n\n from model_utils.managers import InheritanceManager\n from dj_queryset_manager import QuerySetManagerMixin, queryset_method\n\n class MyInheritanceManager(QuerySetManagerMixin, InheritanceManager):\n @queryset_method\n def by_slug(queryset, slug):\n return queryset.filter(slug=slug)\n\n\nInstallation\n------------\n\n $ pip install dj-queryset-manager", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nosamanuel/dj-queryset-manager", "keywords": null, "license": "Copyright (c) 2013, Noah Seger\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n * Neither the name of cottonmouth nor the names of its contributors\n may be used to endorse or promote products derived from this software\n without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\nCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\nEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\nPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "maintainer": null, "maintainer_email": null, "name": "dj-queryset-manager", "package_url": "https://pypi.org/project/dj-queryset-manager/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/dj-queryset-manager/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/nosamanuel/dj-queryset-manager" }, "release_url": "https://pypi.org/project/dj-queryset-manager/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "Stop writing Django querysets.", "version": "0.1.3" }, "last_serial": 1140858, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "c16601193da29b8e9b48ac0b94b989a0", "sha256": "f9e68ee3a337fa7563e86cc80f1eaaf7e3769033a384d5235672e1a734625cec" }, "downloads": -1, "filename": "dj-queryset-manager-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c16601193da29b8e9b48ac0b94b989a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3619, "upload_time": "2013-10-09T05:33:14", "url": "https://files.pythonhosted.org/packages/9e/18/823858a463cc153e1b67e9d7ae4c306737042049098f15375655406a467c/dj-queryset-manager-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "6c4448146b8d881ffb95d92c86b9086a", "sha256": "883832968c92adccfdb760c2603a18385a7e3af5a4e52150a8dba712f21c520d" }, "downloads": -1, "filename": "dj-queryset-manager-0.1.2.tar.gz", "has_sig": false, "md5_digest": "6c4448146b8d881ffb95d92c86b9086a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3759, "upload_time": "2014-06-28T18:15:14", "url": "https://files.pythonhosted.org/packages/27/24/d8a13e549bb677cc73d80394e9c86dc7ca0042c9fd543ff400abb86e6809/dj-queryset-manager-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "49445a90327cc7a5ff3ee05ed6636797", "sha256": "0effdba31d6d9abddd8fd1386337ad5de1403c3156607dae2188c7bcbc75a410" }, "downloads": -1, "filename": "dj-queryset-manager-0.1.3.tar.gz", "has_sig": false, "md5_digest": "49445a90327cc7a5ff3ee05ed6636797", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3598, "upload_time": "2014-06-28T19:03:43", "url": "https://files.pythonhosted.org/packages/fe/aa/a51fffa00e1039fb08ea1e552fd96b0c159117254cb528187aa54847a84e/dj-queryset-manager-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "49445a90327cc7a5ff3ee05ed6636797", "sha256": "0effdba31d6d9abddd8fd1386337ad5de1403c3156607dae2188c7bcbc75a410" }, "downloads": -1, "filename": "dj-queryset-manager-0.1.3.tar.gz", "has_sig": false, "md5_digest": "49445a90327cc7a5ff3ee05ed6636797", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3598, "upload_time": "2014-06-28T19:03:43", "url": "https://files.pythonhosted.org/packages/fe/aa/a51fffa00e1039fb08ea1e552fd96b0c159117254cb528187aa54847a84e/dj-queryset-manager-0.1.3.tar.gz" } ] }