Package django :: Package db :: Package models :: Module query :: Class _QuerySet
[hide private]
[frames] | no frames]

Class _QuerySet

source code

object --+
         |
        _QuerySet

Represents a lazy database lookup for a set of objects

Instance Methods [hide private]
 
__init__(self, model=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__repr__(self)
repr(x)
source code
 
__len__(self) source code
 
__iter__(self) source code
 
__getitem__(self, k)
Retrieve an item or slice from the set of results.
source code
 
__and__(self, other) source code
 
__or__(self, other) source code
 
iterator(self)
Performs the SELECT database lookup of this QuerySet.
source code
 
count(self)
Performs a SELECT COUNT() and returns the number of records as an integer.
source code
 
get(self, *args, **kwargs)
Performs the SELECT and returns a single object matching the given keyword arguments.
source code
 
create(self, **kwargs)
Create a new object with the given kwargs, saving it to the database and returning the created object.
source code
 
get_or_create(self, **kwargs)
Looks up an object with the given kwargs, creating one if necessary.
source code
 
latest(self, field_name=None)
Returns the latest object, according to the model's 'get_latest_by' option or optional given field_name.
source code
 
in_bulk(self, id_list)
Returns a dictionary mapping each of the given IDs to the object with that ID.
source code
 
delete(self)
Deletes the records in the current QuerySet.
source code
 
values(self, *fields) source code
 
dates(self, field_name, kind, order='ASC')
Returns a list of datetime objects representing all available dates for the given field_name, scoped to 'kind'.
source code
 
filter(self, *args, **kwargs)
Returns a new QuerySet instance with the args ANDed to the existing set.
source code
 
exclude(self, *args, **kwargs)
Returns a new QuerySet instance with NOT (args) ANDed to the existing set.
source code
 
_filter_or_exclude(self, mapper, *args, **kwargs) source code
 
complex_filter(self, filter_obj)
Returns a new QuerySet instance with filter_obj added to the filters.
source code
 
select_related(self, true_or_false=True, depth=0)
Returns a new QuerySet instance with '_select_related' modified.
source code
 
order_by(self, *field_names)
Returns a new QuerySet instance with the ordering changed.
source code
 
distinct(self, true_or_false=True)
Returns a new QuerySet instance with '_distinct' modified.
source code
 
extra(self, select=None, where=None, params=None, tables=None) source code
 
_clone(self, klass=None, **kwargs) source code
 
_combine(self, other) source code
 
_get_data(self) source code
 
_get_sql_clause(self) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, model=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

count(self)

source code 

Performs a SELECT COUNT() and returns the number of records as an integer.

If the queryset is already cached (i.e. self._result_cache is set) this simply returns the length of the cached results set to avoid multiple SELECT COUNT(*) calls.

get_or_create(self, **kwargs)

source code 

Looks up an object with the given kwargs, creating one if necessary. Returns a tuple of (object, created), where created is a boolean specifying whether an object was created.

complex_filter(self, filter_obj)

source code 

Returns a new QuerySet instance with filter_obj added to the filters. filter_obj can be a Q object (has 'get_sql' method) or a dictionary of keyword lookup arguments.