• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Djblets 0.9
    2. Version 5.x
    3. Version 4.x
    4. Version 3.x
    5. Version 2.x
    6. Version 2.0
    7. Version 1.0
    8. Version 0.9
    9. Djblets Documentation
    10. Module and Class References
    11. djblets.db.query
  • Home
  • Guides
  • Extension Guides
  • Writing Extensions
  • Testing Extensions
  • Web API Guides
  • Writing Web API Resources
  • Module and Class References
  • djblets
  • djblets.auth.forms
  • djblets.auth.signals
  • djblets.auth.util
  • djblets.auth.views
  • djblets.cache.backend
  • djblets.cache.backend_compat
  • djblets.cache.context_processors
  • djblets.cache.errors
  • djblets.cache.forwarding_backend
  • djblets.cache.serials
  • djblets.configforms.forms
  • djblets.configforms.pages
  • djblets.configforms.views
  • djblets.datagrid.grids
  • djblets.db.backends.mysql.base
  • djblets.db.fields
  • djblets.db.managers
  • djblets.db.query
  • djblets.db.validators
  • djblets.extensions.errors
  • djblets.extensions.extension
  • djblets.extensions.forms
  • djblets.extensions.hooks
  • djblets.extensions.loaders
  • djblets.extensions.manager
  • djblets.extensions.middleware
  • djblets.extensions.models
  • djblets.extensions.packaging
  • djblets.extensions.resources
  • djblets.extensions.settings
  • djblets.extensions.signals
  • djblets.extensions.staticfiles
  • djblets.extensions.testing
  • djblets.extensions.testing.testcases
  • djblets.extensions.urls
  • djblets.extensions.views
  • djblets.extensions.templatetags.djblets_extensions
  • djblets.feedview.views
  • djblets.feedview.templatetags.feedtags
  • djblets.forms.fields
  • djblets.gravatars
  • djblets.gravatars.templatetags.gravatars
  • djblets.log
  • djblets.log.middleware
  • djblets.log.siteconfig
  • djblets.log.urls
  • djblets.log.views
  • djblets.mail.dmarc
  • djblets.mail.message
  • djblets.mail.testing
  • djblets.mail.utils
  • djblets.markdown
  • djblets.markdown.extensions.wysiwyg
  • djblets.markdown.extensions.wysiwyg_email
  • djblets.siteconfig.context_processors
  • djblets.siteconfig.django_settings
  • djblets.siteconfig.forms
  • djblets.siteconfig.managers
  • djblets.siteconfig.middleware
  • djblets.siteconfig.models
  • djblets.siteconfig.views
  • djblets.template.loaders.conditional_cached
  • djblets.template.loaders.namespaced_app_dirs
  • djblets.testing.decorators
  • djblets.testing.testcases
  • djblets.testing.testrunners
  • djblets.urls.context_processors
  • djblets.urls.decorators
  • djblets.urls.patterns
  • djblets.urls.resolvers
  • djblets.urls.root
  • djblets.urls.staticfiles
  • djblets.util.contextmanagers
  • djblets.util.dates
  • djblets.util.decorators
  • djblets.util.filesystem
  • djblets.util.http
  • djblets.util.humanize
  • djblets.util.serializers
  • djblets.util.views
  • djblets.util.templatetags.djblets_deco
  • djblets.util.templatetags.djblets_email
  • djblets.util.templatetags.djblets_forms
  • djblets.util.templatetags.djblets_images
  • djblets.util.templatetags.djblets_js
  • djblets.util.templatetags.djblets_utils
  • djblets.webapi.auth
  • djblets.webapi.auth.backends
  • djblets.webapi.auth.backends.api_tokens
  • djblets.webapi.auth.backends.base
  • djblets.webapi.auth.backends.basic
  • djblets.webapi.auth.views
  • djblets.webapi.decorators
  • djblets.webapi.encoders
  • djblets.webapi.errors
  • djblets.webapi.managers
  • djblets.webapi.models
  • djblets.webapi.resources
  • djblets.webapi.resources.base
  • djblets.webapi.resources.group
  • djblets.webapi.resources.registry
  • djblets.webapi.resources.root
  • djblets.webapi.resources.user
  • djblets.webapi.resources.mixins.api_tokens
  • djblets.webapi.resources.mixins.forms
  • djblets.webapi.resources.mixins.queries
  • djblets.webapi.responses
  • djblets.webapi.testing
  • djblets.webapi.testing.decorators
  • djblets.webapi.testing.testcases
  • djblets
  • djblets.auth.forms
  • djblets.auth.signals
  • djblets.auth.util
  • djblets.auth.views
  • djblets.cache.backend
  • djblets.cache.backend_compat
  • djblets.cache.context_processors
  • djblets.cache.errors
  • djblets.cache.forwarding_backend
  • djblets.cache.serials
  • djblets.configforms.forms
  • djblets.configforms.pages
  • djblets.configforms.views
  • djblets.datagrid.grids
  • djblets.db.backends.mysql.base
  • djblets.db.fields
  • djblets.db.managers
  • djblets.db.query
  • djblets.db.validators
  • djblets.extensions.errors
  • djblets.extensions.extension
  • djblets.extensions.forms
  • djblets.extensions.hooks
  • djblets.extensions.loaders
  • djblets.extensions.manager
  • djblets.extensions.middleware
  • djblets.extensions.models
  • djblets.extensions.packaging
  • djblets.extensions.resources
  • djblets.extensions.settings
  • djblets.extensions.signals
  • djblets.extensions.staticfiles
  • djblets.extensions.testing
  • djblets.extensions.testing.testcases
  • djblets.extensions.urls
  • djblets.extensions.views
  • djblets.extensions.templatetags.djblets_extensions
  • djblets.feedview.views
  • djblets.feedview.templatetags.feedtags
  • djblets.forms.fields
  • djblets.gravatars
  • djblets.gravatars.templatetags.gravatars
  • djblets.log
  • djblets.log.middleware
  • djblets.log.siteconfig
  • djblets.log.urls
  • djblets.log.views
  • djblets.mail.dmarc
  • djblets.mail.message
  • djblets.mail.testing
  • djblets.mail.utils
  • djblets.markdown
  • djblets.markdown.extensions.wysiwyg
  • djblets.markdown.extensions.wysiwyg_email
  • djblets.siteconfig.context_processors
  • djblets.siteconfig.django_settings
  • djblets.siteconfig.forms
  • djblets.siteconfig.managers
  • djblets.siteconfig.middleware
  • djblets.siteconfig.models
  • djblets.siteconfig.views
  • djblets.template.loaders.conditional_cached
  • djblets.template.loaders.namespaced_app_dirs
  • djblets.testing.decorators
  • djblets.testing.testcases
  • djblets.testing.testrunners
  • djblets.urls.context_processors
  • djblets.urls.decorators
  • djblets.urls.patterns
  • djblets.urls.resolvers
  • djblets.urls.root
  • djblets.urls.staticfiles
  • djblets.util.contextmanagers
  • djblets.util.dates
  • djblets.util.decorators
  • djblets.util.filesystem
  • djblets.util.http
  • djblets.util.humanize
  • djblets.util.serializers
  • djblets.util.views
  • djblets.util.templatetags.djblets_deco
  • djblets.util.templatetags.djblets_email
  • djblets.util.templatetags.djblets_forms
  • djblets.util.templatetags.djblets_images
  • djblets.util.templatetags.djblets_js
  • djblets.util.templatetags.djblets_utils
  • djblets.webapi.auth
  • djblets.webapi.auth.backends
  • djblets.webapi.auth.backends.api_tokens
  • djblets.webapi.auth.backends.base
  • djblets.webapi.auth.backends.basic
  • djblets.webapi.auth.views
  • djblets.webapi.decorators
  • djblets.webapi.encoders
  • djblets.webapi.errors
  • djblets.webapi.managers
  • djblets.webapi.models
  • djblets.webapi.resources
  • djblets.webapi.resources.base
  • djblets.webapi.resources.group
  • djblets.webapi.resources.registry
  • djblets.webapi.resources.root
  • djblets.webapi.resources.user
  • djblets.webapi.resources.mixins.api_tokens
  • djblets.webapi.resources.mixins.forms
  • djblets.webapi.resources.mixins.queries
  • djblets.webapi.responses
  • djblets.webapi.testing
  • djblets.webapi.testing.decorators
  • djblets.webapi.testing.testcases
  • General Index
  • Python Module Index
  • Release Notes
  • This documentation covers Djblets 0.9. You can select a version above or view the latest documentation.

    djblets.db.query¶

    class LocalDataQuerySet(data)[source]¶

    Bases: object

    A QuerySet that operates on generic data provided by the caller.

    This can be used in some circumstances when code requires a QuerySet, but where the data doesn’t come from the database. The caller can instantiate one of these and provide it.

    This doesn’t perform full support for all of QuerySet’s abilities. It does, however, support the following basic functions:

    • all
    • clone
    • count
    • exclude
    • filter
    • get
    • order_by
    • prefetch_related
    • select_related

    As well as the operators expected by consumers of QuerySet, such as __len__ and __iter__.

    This is particularly handy with WebAPIResource.

    PROPERTY_REGEX = <_sre.SRE_Pattern object>[source]¶
    __init__(data)[source]¶
    all()[source]¶

    Returns a cloned copy of this queryset.

    clone()[source]¶

    Returns a cloned copy of this queryset.

    count()[source]¶

    Returns the number of items in this queryset.

    exclude(**kwargs)[source]¶

    Returns a queryset excluding items from this queryset.

    The result will be a LocalDataQuerySet that contains all items from this queryset that do not contain attributes with values matching those that were passed to this function as keyword arguments.

    filter(**kwargs)[source]¶

    Returns a queryset filtering items from this queryset.

    The result will be a LocalDataQuerySet that contains all items from this queryset that contain attributes with values matching those that were passed to this function as keyword arguments.

    get(**kwargs)[source]¶

    Returns a single result from this queryset.

    This will return a single result from the list of items in this queryset. If keyword arguments are provided, they will be used to filter the queryset down.

    There must be only one item in the queryset matching the given criteria, or a MultipleObjectsReturned will be raised. If there are no items, then an ObjectDoesNotExist will be raised.

    order_by(*attrs, **kwargs)[source]¶

    Returns a queryset ordering items by the specified attributes.

    The result will be a LocalDataQuerySet that contains all items from this queryset ordered by the attributes specified. If multiple attributes are specified, the items are sorted by the first attribute and ties are broken by the other following attributes.

    All items are sorted in ascending order. To specify a descending order, an attribute must have a ‘-‘ prepended to the name, such as -attribute_A.

    prefetch_related(*args, **kwargs)[source]¶

    Stub for compatibility with QuerySet.prefetch_related.

    This will simply return a clone of this queryset.

    select_related(*args, **kwargs)[source]¶

    Stub for compatibility with QuerySet.select_related.

    This will simply return a clone of this queryset.

    __contains__(i)[source]¶
    __getitem__(i)[source]¶
    __getslice__(i, j)[source]¶
    __iter__()[source]¶
    __len__()[source]¶
    chainable_select_related_queryset(queryset)[source]¶

    Allow for chaining select_related calls on a queryset.

    This is a workaround for Django 1.6’s inability to chain calls to QuerySet.select_related(). When using Django 1.6, the returned queryset will be a special type that handles the chaining. On Django 1.7 and higher, querysets support this natively, so this function will just return the queryset as-is.

    Parameters:queryset (django.db.models.query.QuerySet) – The queryset to make chainable.
    Returns:A queryset that allows for chaining.
    Return type:django.db.models.query.QuerySet
    get_object_or_none(klass, *args, **kwargs)[source]¶

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]