moo.core.models.acl.WizardGuardedQuerySet
- class moo.core.models.acl.WizardGuardedQuerySet(model=None, query=None, using=None, hints=None)
QuerySet whose bulk-mutation methods require a wizard caller.
Pairs with the wizard-only save()/delete() overrides on the owning models: update()/delete()/bulk_create()/bulk_update() bypass instance save/delete, so they need their own gate. Django’s async variants (aupdate/adelete) delegate to these sync methods and are covered. Cascade deletion (e.g. User -> Player) uses the deletion Collector, not QuerySet.delete(), and is intentionally unguarded.
- __init__(model=None, query=None, using=None, hints=None)
Methods
__init__([model, query, using, hints])aaggregate(*args, **kwargs)abulk_create(objs[, batch_size, ...])abulk_update(objs, fields[, batch_size])acontains(obj)acount()acreate(**kwargs)adelete()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()Return a new QuerySet that is a copy of the current one.
annotate(*args, **kwargs)Return a query set in which the returned objects have been annotated with extra data or aggregations.
as_manager()aupdate(**kwargs)aupdate_or_create([defaults, create_defaults])bulk_create(objs, *args, **kwargs)Insert each of the instances into the database.
bulk_update(objs, fields, *args, **kwargs)Update the given fields in each of the given objects in the database.
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.
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'.
defer(*fields)Defer the loading of data for certain fields until they are accessed.
delete()Delete the records in the current QuerySet.
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.
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.
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])resolve_expression(*args, **kwargs)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
dbReturn the database used if this query is executed now.
orderedReturn True if the QuerySet is ordered -- i.e. has an order_by() clause or a default ordering on the model (or is empty).
query