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 model method is used for updating a ManyToManyField.






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






3. Keyword shortcut for looking up an object by primary key.






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






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






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






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






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






9. This query finds all entries between a start date of start_date and an end date of end_date.






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






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






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






13. Fields are specified by these






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






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






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






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






18. Here - you can't use add - create - or assignment (i.e. - beatles.members = [...]) to create relationships. You need to specify all the detail for the relationship required by the intermediate model.






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






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






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






22. Adds to each object in the QuerySet with the provided list of aggregate values (averages - sums - etc) that have been computed over the objects that are related to the objects in the QuerySet. Each argument to this is content that will be added to ea






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






24. When to run syncdb






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






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






27. Manager method used to retrieve every object in a model.






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






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






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






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






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






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






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






35. Returns a new QuerySet containing objects that match the given lookup parameters.






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






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






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






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






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


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






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






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






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






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






46. These are specified as keyword arguments to the QuerySet methods filter() - exclude() and get(). These take the form field__lookuptype=value .






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






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






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






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







Sorry!:) No result found.

Can you answer 50 questions in 15 minutes?


Let me suggest you:



Major Subjects



Tests & Exams


AP
CLEP
DSST
GRE
SAT
GMAT

Most popular tests