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 for date/datetime fields that finds an exact month match. Takes an integer 1 (January) through 12






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






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






4. Lookup type that returns results greater than a given value.






5. Lookup type that returns results in a given list.






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






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






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






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






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






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






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






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






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






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






16. Conjuntion operator for Q objects.






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






18. Returns the object matching the given lookup parameters






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






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






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






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






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






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






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






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






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






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






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






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






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


32. To activate your models






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






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






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






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






37. When to run syncdb






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






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






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






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






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






43. Returns a new QuerySet that uses SELECT DISTINCT in its SQL query. This eliminates duplicate rows from the query results.






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






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






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






47. This gives your model metadata.






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






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






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