moo.core.managers.SiteManager

class moo.core.managers.SiteManager(*args, **kwargs)

Manager that automatically filters Objects to the current site.

__init__()

Methods

__init__()

aaggregate(*args, **kwargs)

abulk_create(objs[, batch_size, ...])

abulk_update(objs, fields[, batch_size])

acontains(obj)

acount()

acreate(**kwargs)

aearliest(*fields)

aexists()

aexplain(*[, format])

afirst()

aget(*args, **kwargs)

aget_or_create([defaults])

aggregate(*args, **kwargs)

Return a dictionary containing the calculations (aggregation) over the current queryset.

ain_bulk([id_list, field_name])

aiterator([chunk_size])

An asynchronous iterator over the results from applying this QuerySet to the database.

alast()

alatest(*fields)

alias(*args, **kwargs)

Return a query set with added aliases for extra data or aggregations.

all()

annotate(*args, **kwargs)

Return a query set in which the returned objects have been annotated with extra data or aggregations.

aupdate(**kwargs)

aupdate_or_create([defaults, create_defaults])

bulk_create(objs[, batch_size, ...])

Insert each of the instances into the database.

bulk_update(objs, fields[, batch_size])

Update the given fields in each of the given objects in the database.

check(**kwargs)

complex_filter(filter_obj)

Return a new QuerySet instance with filter_obj added to the filters.

contains(obj)

Return True if the QuerySet contains the provided obj, False otherwise.

contribute_to_class(cls, name)

count()

Perform a SELECT COUNT() and return the number of records as an integer.

create(**kwargs)

Create a new object with the given kwargs, saving it to the database and returning the created object.

dates(field_name, kind[, order])

Return a list of date objects representing all available dates for the given field_name, scoped to 'kind'.

datetimes(field_name, kind[, order, tzinfo])

Return a list of datetime objects representing all available datetimes for the given field_name, scoped to 'kind'.

db_manager([using, hints])

deconstruct()

Return a 5-tuple of the form (as_manager (True), manager_class, queryset_class, args, kwargs).

defer(*fields)

Defer the loading of data for certain fields until they are accessed.

difference(*other_qs)

distinct(*field_names)

Return a new QuerySet instance that will select only distinct results.

earliest(*fields)

exclude(*args, **kwargs)

Return a new QuerySet instance with NOT (args) ANDed to the existing set.

exists()

Return True if the QuerySet would have any results, False otherwise.

explain(*[, format])

Runs an EXPLAIN on the SQL query this QuerySet would perform, and returns the results.

extra([select, where, params, tables, ...])

Add extra SQL fragments to the query.

filter(*args, **kwargs)

Return a new QuerySet instance with the args ANDed to the existing set.

first()

Return the first object of a query or None if no match is found.

from_queryset(queryset_class[, class_name])

get(*args, **kwargs)

Perform the query and return a single object matching the given keyword arguments.

get_or_create([defaults])

Look up an object with the given kwargs, creating one if necessary.

get_queryset()

Return a new QuerySet object.

in_bulk([id_list, field_name])

Return a dictionary mapping each of the given IDs to the object with that ID.

intersection(*other_qs)

iterator([chunk_size])

An iterator over the results from applying this QuerySet to the database.

last()

Return the last object of a query or None if no match is found.

latest(*fields)

Return the latest object according to fields (if given) or by the model's Meta.get_latest_by.

none()

Return an empty QuerySet.

only(*fields)

Essentially, the opposite of defer().

order_by(*field_names)

Return a new QuerySet instance with the ordering changed.

prefetch_related(*lookups)

Return a new QuerySet instance that will prefetch the specified Many-To-One and Many-To-Many related objects when the QuerySet is evaluated.

raw(raw_query[, params, translations, using])

reverse()

Reverse the ordering of the QuerySet.

select_for_update([nowait, skip_locked, of, ...])

Return a new QuerySet instance that will select objects with a FOR UPDATE lock.

select_related(*fields)

Return a new QuerySet instance that will select related objects.

union(*other_qs[, all])

update(**kwargs)

Update all elements in the current QuerySet, setting all the given fields to the appropriate values.

update_or_create([defaults, create_defaults])

Look up an object with the given kwargs, updating one with defaults if it exists, otherwise create a new one.

using(alias)

Select which database this QuerySet should execute against.

values(*fields, **expressions)

values_list(*fields[, flat, named])

Attributes

auto_created

creation_counter

db

use_in_migrations

If set to True the manager will be serialized into migrations and will thus be available in e.g. RunPython operations.