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. The database that will be used if this query is executed now






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






3. Negation operator for Q objects.






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






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






6. Returns the object matching the given lookup parameters






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






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






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






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






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






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






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






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






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






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






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






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






19. Disjunction operator for Q objects.






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






21. When to run syncdb






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






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






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






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






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






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






28. This query updates all the headlines with pub_date in 2007 to read 'Everything is the same'.

Warning: Invalid argument supplied for foreach() in /var/www/html/basicversity.com/show_quiz.php on line 183


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






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






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






32. Conjuntion operator for Q objects.






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






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


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






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. This field is added automatically - but this behavior can be overridden






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






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






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






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






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






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






44. The first element in this iterable is the value that will be stored in the database - the second element will be displayed by the admin interface - or in a ModelChoiceField.






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






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






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. If you are using this attribute on a ForeignKey or ManyToManyField - you must always specify a unique reverse name for the field.






49. To activate your models






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