Home > Django > Quizzes > Django Queryset
Django Queryset
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 29% Most missed: “Performs an SQL delete query on all rows in the QuerySet. This method is applied…”
Django Queryset
Time left 00:00
25 Questions

1. These add custom "row-level" functionality to your objects. These act on a particular model instance.

2. This object encapsulates a collection of keyword arguments - with the keys being field lookup types. These objects can be combined using the & and | operators - as well as negated with the ~ operator.

3. Returns True if the QuerySet contains any results - and False if not. This tries to perform the query in the simplest and fastest way possible - but it does execute nearly the same query. This means that calling this method on a queryset is faster th

4. This tells Django how to calculate the URL for an object. Django uses this in its admin interface - and any time it needs to figure out a URL for an object.

5. This method returns tuples of values when iterated over. Each tuple contains the value from the respective field passed into the call to this method -- so the first item is the first field - etc.

6. Lookup type that returns results less than a given value.

7. A manager method which returns a single object. If there are no results that match the query - this method will raise a DoesNotExist exception. If more than one item matches this query - the method will raise MultipleObjectsReturned.

8. Defined by django.db.models.ForeignKey. You use it just like any other Field type: by including it as a class attribute of your model.

9. 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.

10. Lookup type that finds a case-sensitive regular expression match.

11. Negation operator for Q objects.

12. Each one of these is a Python class that subclasses django.db.models.Model. Each attribute of one of these represents a database field.

13. A convenience method for looking up an object with the given kwargs - creating one if necessary.

14. restrictions on ________: (1) Your intermediate model must contain one - and only one - foreign key to the target model. (2) Your intermediate model must contain one - and only one - foreign key to the source model. (3) When defining a many-to-many r

15. Returns an integer representing the number of objects in the database matching the QuerySet. This never raises exceptions.

16. Manager method used to retrieve every object in a model.

17. Lookup type for date/datetime fields that finds an exact month match. Takes an integer 1 (January) through 12

18. True if the QuerySet has an order_by() clause or a default ordering on the model. False otherwise.

19. If True - this field is the primary key for the model.

20. If this option is True - the field is allowed to be blank. Default is False.

21. 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. If you have a model where almost all the fields need to be deferred - using this method to specify the complementary

22. This model method is used for updating a ManyToManyField.

23. In some complex data-modeling situations - your models might contain a lot of fields - some of which could contain a lot of data (for example - text fields) - or require expensive processing to convert them to Python objects. If you are using the res

24. Defined by a ManyToManyField. You use it just like any other Field type: by including it as a class attribute of your model.

25. This query finds all entries with an id in the list [1 - 3 - 4]

⚡ Recently practiced quizzes in this topic
Live quiz activity