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. Lookup type that returns results greater than a given value.






2. Fields are specified by these






3. Returns a dictionary of aggregate values (averages - sums - etc) calculated over the QuerySet. Each argument to this method specifies a value that will be included in the dictionary that is returned.






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






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






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


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






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






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






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






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






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






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






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






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






16. Lookup type for date/datetime fields that finds a 'day of the week' match.






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






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






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






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






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






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






23. A Q object that asks for entries with a question value that start with 'Who' or do not have a publication date of 2005.

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


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






25. Takes the ouput of one filter and uses it as input for another filter. This works because a refinement of a QuerySet is itself a QuerySet.






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






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






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






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






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






31. what the field _______ determines: (1) The database column type (e.g. INTEGER - VARCHAR); (2) The widget to use in Django's admin interface - if you care to use it (e.g. <input type="text"> - <select>); (3) The minimal validation requirements - used






32. Can be used to remove all many-to-many relationships for an instance






33. Lookup type that returns results with a case-sensitive start sequence.






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






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






36. Lookup type that corresponds to a boolean full-text search - taking advantage of full-text indexing. This is like contains but is significantly faster due to full-text indexing.






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






38. This query finds all entries with an id greater than 4.






39. This sets a field to a particular value for all the objects in a QuerySet. You can only set non-relation fields and ForeignKey fields using this method.






40. Conjuntion operator for Q objects.






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






42. To activate your models






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






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






45. A Manager method that returns a new QuerySet containing objects that match the given lookup parameters.






46. Lookup type that tests for inclusion in a case-sensitive fashion.






47. If you pickle a QuerySet - this will force all the results to be loaded into memory prior to pickling. When you unpickle a QuerySet - it contains the results at the moment it was pickled - rather than the results that are currently in the database.






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






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






50. Evaluation happens upon use the "step" parameter of slice syntax - the first time you iterate over it - when pickling or caching results - upon calling repr() - upon calling len() - upon calling list() - upon calling bool()