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 that fall into an inclusive date range.






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






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






4. Fields are specified by these






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






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






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






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






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. This gives your model metadata.






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






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






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






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






15. The default for this is the name of the child class followed by '_set'.






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






17. To activate your models






18. Negation operator for Q objects.






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






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






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






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






23. (1) These cannot be Python reserved words - because that would result in a Python syntax error. (2) These cannot contain more than one underscore in a row - due to the way Django's query lookup syntax works.






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


25. Exception raised by get(**kwargs) if more than one item matches the query.






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






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






28. A Python "magic method" that returns a unicode "representation" of any object.






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






30. Conjuntion operator for Q objects.






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






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






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






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






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






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






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






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






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






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






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


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






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






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






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






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






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






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






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






50. Performs an SQL delete query on all rows in the QuerySet. This method is applied instantly. You cannot call this method on a QuerySet that has had a slice taken or can otherwise no longer be filtered.