معرفی شرکت ها


dj-queryset-manager-0.1.3


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Stop writing Django querysets.
ویژگی مقدار
سیستم عامل -
نام فایل dj-queryset-manager-0.1.3
نام dj-queryset-manager
نسخه کتابخانه 0.1.3
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Noah Seger
ایمیل نویسنده nosamanuel@gmail.com
آدرس صفحه اصلی https://github.com/nosamanuel/dj-queryset-manager
آدرس اینترنتی https://pypi.org/project/dj-queryset-manager/
مجوز Copyright (c) 2013, Noah Seger All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of cottonmouth nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dj-queryset-manager ~~~~~~~~~~~~~~~~~~~ A Django utility that makes it simple to write DRY queryset methods. Warning ------- dj-queryset-manager only works with Django versions 1.2 through 1.6. In Django 1.7 it has been superseded by ``QuerySet.as_manager()``. See `the docs <https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.as_manager>`_. Usage ----- 1. Create a manager class that inherit the ``QuerySetManager`` 2. Decorate your filter methods with ``queryset_method``. **These methods receive a queryset instead of a manager as the first argument**. .. code:: python from dj_queryset_manager import QuerySetManager, queryset_method class MyManager(QuerySetManager): @queryset_method def by_slug(queryset, slug): return queryset.filter(slug=slug) @queryset_method def filter(queryset, *args, **kwargs): return super(type(queryset), queryset).filter(*args, **kwargs) For reference, here is a standard implementation: .. code:: python from django.db.models import Manager from django.db.models.query import QuerySet class MyQuerySet(QuerySet): def by_slug(self, slug): return self.filter(slug=slug) def filter(self, *args, **kwargs): return super(MyQuerySet, self).filter(*args, **kwargs) class MyManager(Manager): def get_query_set(self): # Better remember the arguments to QuerySet QuerySet(self.model, using=self._db) def get_queryset(self): # And don't forget about Django 1.6 return self.get_query_set() def by_slug(self, *args, **kwargs): # Enjoy this duplicate signature return self.get_queryset().filter(*args, **kwargs) Mix-in ------ Some 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 <https://github.com/carljm/django-model-utils>`_. .. code:: python from model_utils.managers import InheritanceManager from dj_queryset_manager import QuerySetManagerMixin, queryset_method class MyInheritanceManager(QuerySetManagerMixin, InheritanceManager): @queryset_method def by_slug(queryset, slug): return queryset.filter(slug=slug) Installation ------------ $ pip install dj-queryset-manager


نحوه نصب


نصب پکیج whl dj-queryset-manager-0.1.3:

    pip install dj-queryset-manager-0.1.3.whl


نصب پکیج tar.gz dj-queryset-manager-0.1.3:

    pip install dj-queryset-manager-0.1.3.tar.gz