Details of the QuerySet API.
Popularity (by total correct streak): 4
Popularity (by number of users): 3
Returns a new QuerySet containing objects that match the given lookup parameters. | filter | |
Returns a new QuerySet containing objects that do not match the given lookup parameters. | exclude | |
Annotates each object in the QuerySet with the provided list of aggregate values (averages, sums, etc) that have been computed over the objects that are related to the objects in the QuerySet. | annotate | |
By default, results returned by a QuerySet are ordered by the ordering tuple given by the ordering option in the model's Meta. You can override this on a per-QuerySet basis by using the this method. | order_by | |
Use this method to reverse the order in which a queryset's elements are returned. Calling this method a second time restores the ordering back to the normal direction. | reverse | |
Returns a new QuerySet that uses SELECT DISTINCT in its SQL query. This eliminates duplicate rows from the query results. | distinct | |
Returns a ValuesQuerySet — a QuerySet subclass that returns dictionaries when used as an iterable, rather than model-instance objects. | values | |
This is similar to values() except that instead of returning dictionaries, it returns tuples when iterated over. | values_list | |
Returns a DateQuerySet — a QuerySet that evaluates to a list of datetime.datetime objects representing all available dates of a particular kind within the contents of the QuerySet. | dates | |
Returns an EmptyQuerySet — a QuerySet subclass that always evaluates to an empty list. This can be used in cases where you know that you should return an empty result set and your caller is expecting a QuerySet object (instead of returning an empty list, for example.) | none | |
Returns a copy of the current QuerySet (or QuerySet subclass). | all | |
Returns a QuerySet that will automatically "follow" foreign-key relationships, selecting that additional related-object data when it executes its query. | select_related | |
Returns a QuerySet that will automatically retrieve, in a single batch, related objects for each of the specified lookups. | prefetch_related | |
Sometimes, the Django query syntax by itself can't easily express a complex WHERE clause.. For these edge cases, Django provides this QuerySet modifier — a hook for injecting specific clauses into the SQL generated by a QuerySet. | extra | |
If you are using the results of a queryset in some situation where you know you don't know if you need those particular fields when you initially fetch the data, you can tell Django not to retrieve them from the database. | defer | |
This method is more or less the opposite of defer(). You call it with the fields that should not be deferred when retrieving a model. | only | |
This method is for controlling which database the QuerySet will be evaluated against if you are using more than one database. | using | |
Returns a queryset that will lock rows until the end of the transaction, generating a SELECT ... FOR UPDATE SQL statement on supported databases. | select_for_update | |
Returns the object matching the given lookup parameters, which should be in the format described in Field lookups. | get | |
A convenience method for creating an object and saving it all in one step. | create | |
A convenience method for looking up an object with the given kwargs, creating one if necessary. | get_or_create | |
This method inserts the provided list of objects into the database in an efficient manner. | bulk_create | |
Returns an integer representing the number of objects in the database matching the QuerySet. | count | |
Takes a list of primary-key values and returns a dictionary mapping each primary-key value to an instance of the object with the given ID. | in_bulk | |
Evaluates the QuerySet (by performing the query) and returns an iterator (see PEP 234) over the results. | iterator | |
Returns the latest object in the table, by date, using the field_name provided as the date field. | latest | |
Returns a dictionary of aggregate values (averages, sums, etc) calculated over the QuerySet. | aggregate | |
Returns True if the QuerySet contains any results, and False if not. | exists | |
Performs an SQL update query for the specified fields, and returns the number of rows affected. | update | |
Performs an SQL delete query on all rows in the QuerySet. | delete | |
Exact match. If the value provided for comparison is None, it will be interpreted as an SQL NULL. | exact | |
Case-insensitive exact match. | iexact | |
Case-sensitive containment test. | contains | |
Case-insensitive containment test. | icontains | |
In a given list. | in | |
Greater than. | gt | |
Greater than or equal to. | gte | |
Less than. | lt | |
Less than or equal to. | lte | |
Case-sensitive starts-with. | startswith | |
Case-insensitive starts-with. | istartswith | |
Case-sensitive ends-with. | endswith | |
Case-insensitive ends-with. | iendswith | |
Range test (inclusive). | range | |
For date/datetime fields, exact year match. Takes a four-digit year. | year | |
For date and datetime fields, an exact month match. Takes an integer 1 (January) through 12 (December). | month | |
For date and datetime fields, an exact day match. | day | |
For date and datetime fields, a 'day of the week' match. | week_day | |
Takes either True or False, which correspond to SQL queries of IS NULL and IS NOT NULL, respectively. | isnull | |
A boolean full-text search, taking advantage of full-text indexing. This is like contains but is significantly faster due to full-text indexing. | search | |
Case-sensitive regular expression match. | regex | |
Case-insensitive regular expression match. | iregex | |
Returns the mean value of the given field, which must be numeric. | Avg | |
Returns the number of objects that are related through the provided field. | Count | |
Returns the maximum value of the given field. | Max | |
Returns the minimum value of the given field. | Min | |
Returns the standard deviation of the data in the provided field. | StdDev | |
Computes the sum of all values of the given field. | Sum | |
Returns the variance of the data in the provided field. | Variance |
Quisition is a browser-based flashcard system that repeats old cards and introduces new ones at optimal time intervals. You can create your own card packs or use those developed by others.