Ticket #6875: custom_queryset_setting.diff

File custom_queryset_setting.diff, 2.8 KB (added by floguy, 17 years ago)
  • django/db/models/query.py

     
    1616# Pull into this namespace for backwards compatibility
    1717EmptyResultSet = sql.EmptyResultSet
    1818
    19 class _QuerySet(object):
     19class BaseQuerySet(object):
    2020    "Represents a lazy database lookup for a set of objects"
    2121    def __init__(self, model=None, query=None):
    2222        self.model = model
     
    470470            except StopIteration:
    471471                self._iter = None
    472472
    473 # Use the backend's QuerySet class if it defines one. Otherwise, use _QuerySet.
     473# Use the backend's QuerySet class if it defines one. Otherwise, use
     474# the BaseQuerySet subclass defined in settings.DEFAULT_QUERYSET_CLASS
     475qs_path = settings.DEFAULT_QUERYSET_CLASS
     476i = qs_path.rfind('.')
     477module, attr = qs_path[:i], qs_path[i+1:]
     478_QuerySet = getattr(__import__(module, {}, {}, ['']), attr)
     479assert issubclass(_QuerySet, BaseQuerySet) # Must be a subclass of django.db.models.query.BaseQuerySet
    474480if connection.features.uses_custom_queryset:
    475481    QuerySet = connection.ops.query_set_class(_QuerySet)
    476482else:
  • django/conf/global_settings.py

     
    250250# Hint: you really don't!
    251251TRANSACTIONS_MANAGED = False
    252252
     253# The custom subclass of BaseQuerySet to use in place of all QuerySet instances.
     254DEFAULT_QUERYSET_CLASS = 'django.db.models.query.BaseQuerySet'
     255
    253256# The User-Agent string to use when checking for URL validity through the
    254257# isExistingURL validator.
    255258from django import get_version
  • AUTHORS

     
    141141    Afonso Fernández Nogueira <fonzzo.django@gmail.com>
    142142    Matthew Flanagan <http://wadofstuff.blogspot.com>
    143143    Eric Floehr <eric@intellovations.com>
     144    Eric Florenzano <floguy@gmail.com>
    144145    Vincent Foley <vfoleybourgon@yahoo.ca>
    145146    Rudolph Froger <rfroger@estrate.nl>
    146147    Jorge Gajon <gajon@gajon.org>
  • docs/settings.txt

     
    437437Default tablespace to use for indexes on fields that don't specify
    438438one, if the backend supports it.
    439439
     440DEFAULT_QUERYSET_CLASS
     441----------------------
     442
     443**New in Django development version**
     444
     445Default: ``'django.db.models.query.BaseQuerySet'``
     446
     447Default QuerySet class to use for all operations.  Should inherit from
     448``django.db.models.query.BaseQuerySet`` to provide custom functionality.
     449
    440450DISALLOWED_USER_AGENTS
    441451----------------------
    442452
Back to Top