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. When to run syncdb






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






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






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






5. Conjuntion operator for Q objects.






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






24. Takes a list of primary-key values and returns a dictionary mapping each primary-key value to an instance of the object with the given ID.






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






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






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






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






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






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






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


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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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