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. This query uses an F object to increment the pingback count for every entry in the blog.

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


2. If this option is True - Django will store empty values as NULL in the database. Default is False.






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






4. A manager method that returns a new QuerySet containing objects that do not match the given lookup parameters.






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






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






7. This is a criterion that narrow down a QuerySet based on given parameters.






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






9. The value given in the absence of a specified value for the field. This can be a value or a callable object. If callable it will be called every time a new object is created.






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






11. Lookup type that yields a case-insensitive match.






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






13. Lookup type that returns results with a case-insensitive end sequence.






14. Fields are specified by these






15. Conjuntion operator for Q objects.






16. Returns a copy of the current QuerySet (or QuerySet subclass you pass in). This can be useful in some situations where you might want to pass in either a model manager or a QuerySet and do further filtering on the result. You can safely call all() on






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






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






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






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






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






22. Exception raised by get(**kwargs) if no items match the query.






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






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






25. Lookup type that yields an "exact" match. If you don't provide a lookup type -- that is - if your keyword argument doesn't contain a double underscore -- the lookup type is assumed to be of this sort.






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






27. Lookup type that returns results in a given list.






28. Evaluates the QuerySet (by performing the query) and returns an iterator over the results. A QuerySet typically caches its results internally so that repeated evaluations do not result in additional queries; this method will instead read results dire






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






30. This style of inheritanc is useful when you're subclassing an existing model (perhaps something from another application entirely) and want each model to have its own database table. Here - each model in the hierarchy is a model all by itself.






31. This gives your model metadata.






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






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






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






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






36. This query deletes all Entry objects with a pub_date year of 2005.






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






38. When to run syncdb






39. Lookup type that returns results less than or equal to a given value.






40. Negation operator for Q objects.






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






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






43. If you are using this attribute on a ForeignKey or ManyToManyField - you must always specify a unique reverse name for the field.






44. This query updates all the headlines with pub_date in 2007 to read 'Everything is the same'.

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


45. This method is for controlling which database the QuerySet will be evaluated against if you are using more than one database. The only argument this method takes is the alias of a database - as defined in DATABASES.






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






47. Disjunction operator for Q objects.






48. Lookup type that returns results greater than a given value.






49. Lookup type that returns results greater than or equal to a given value.






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