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. Manager method used to retrieve every object in a model.






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






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






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






5. a QuerySet can be sliced - using Python's array-slicing syntax.






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






7. Negation operator for Q objects.






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






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






10. A convenience method for constructing an object and saving it all in one step.






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






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






13. Conjuntion operator for Q objects.






14. To activate your models






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






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






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






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






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






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






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






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






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






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






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






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






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


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






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






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






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






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






33. Returns the object matching the given lookup parameters






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






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






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






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






38. Fields are specified by these






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






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






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






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






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






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






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






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






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






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






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


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