Test your basic knowledge |

Django Queryset

Subject : it-skills
Instructions:
  • Answer 50 questions in 15 minutes.
  • If you are not ready to take this test, you can study here.
  • Match each statement with the correct term.
  • Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.

This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. A manager method that returns a new QuerySet containing objects that do not match the given lookup parameters.






2. To activate your models






3. Adds to 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. Each argument to this is content that will be added to ea






4. Defines a many-to-many relationship. You use it just like any other Field type: by including it as a class attribute of your model.






5. Keyword shortcut for looking up an object by primary key.






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






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






8. An iterable (e.g. - a list or tuple) of 2-tuples to use as options for this field. If this is given - Django's admin will use a select box instead of the standard text field and will limit options to those given.






9. This object allows you to compare the value of a model field with another field on the same model. Django supports the use of addition - subtraction - multiplication - division and modulo arithmetic with these objects - both with constants and with o






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






11. The database that will be used if this query is executed now






12. This field is added automatically - but this behavior can be overridden






13. Returns the most recent object in the table - by date - using the field_name provided as the date field.






14. Lookup type that returns results with a case-sensitive end sequence.






15. This query finds all entries between a start date of start_date and an end date of end_date.






16. Used to get a QuerySet for a model. This is called 'objects' by default.






17. A Q object that encapsulates queries for entries with a question value that starts with 'What' in a case-insensitive fashion.

Warning: Invalid argument supplied for foreach() in /var/www/html/basicversity.com/show_quiz.php on line 183


18. Defines a many-to-one relationship. ou use it just like any other Field type: by including it as a class attribute of your model.






19. Lookup type that returns results that fall into an inclusive date range.






20. These methods are intended to do "table-wide" things.






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






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






23. Returns a new QuerySet that uses SELECT DISTINCT in its SQL query. This eliminates duplicate rows from the query results.






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






25. Returns a QuerySet that will automatically "follow" foreign-key relationships - selecting that additional related-object data when it executes its query. This is a performance booster which results in (sometimes much) larger queries but means later u






26. This model method saves a model instance to the database. This method has no return value.






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






28. Lookup type that returns results with a case-insensitive start sequence.






29. Extra text to be displayed under the field on the object's admin form to provide assistance to users. It's useful for documentation even if your object doesn't have an admin form.






30. Lookup type that takes either True or False and corresponds to SQL queries of IS NULL and IS NOT NULL - respectively.






31. The first element in this iterable is the value that will be stored in the database - the second element will be displayed by the admin interface - or in a ModelChoiceField.






32. A QuerySet is iterable - and it executes its database query the first time you iterate over it.






33. Lookup type for date/datetime fields that finds an exact year match. Takes a four-digit year.






34. If True - the table does not permit duplicate values for this field.






35. Lookup type that finds a case-insensitive regular expression match.






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

Warning: Invalid argument supplied for foreach() in /var/www/html/basicversity.com/show_quiz.php on line 183


37. Returns an EmptyQuerySet -- a QuerySet 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 - fo






38. Fields are specified by these






39. This class type is useful when you just want to use the parent class to hold information that you don't want to have to type out for each child model. This class isn't going to ever be used in isolation. When it is used as a base class for other mode






40. Returns a ValuesQuerySet -- a QuerySet that returns dictionaries when used as an iterable - rather than model-instance objects.






41. Returns the object matching the given lookup parameters






42. These are "anything that's not a field" - such as ordering options (ordering) - database table name (db_table) - or human-readable singular and plural names (verbose_name and verbose_name_plural)






43. Performs an SQL update query for the specified fields - and returns the number of rows affected. This method is applied instantly and the only restriction on the QuerySet that is updated is that it can only update columns in the model's main table. F






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






45. Operator for comparing two model instances for equality. Behind the scenes - it compares the primary key values of two models.






46. This method immediately deletes the object and has no return value.






47. Lookup type for date/datetime fields that finds an exact day match.






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






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






50. This represents a collection of objects from your database. It can have zero - one or many filters.







Sorry!:) No result found.

Can you answer 50 questions in 15 minutes?


Let me suggest you:



Major Subjects



Tests & Exams


AP
CLEP
DSST
GRE
SAT
GMAT

Most popular tests