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 that returns results greater than or equal to a given value.






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. Returns the object matching the given lookup parameters






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


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






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






7. Performs an SQL update query for the specified fields - and returns the number of rows affected. This method is applied instantly and the only restriction on the QuerySet that is updated is that it can only update columns in the model's main table. F






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






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






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






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






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






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






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






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






16. A Manager method that returns a new QuerySet containing objects that match the given lookup parameters.






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






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






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






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






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






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






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






24. When to run syncdb






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






26. Returns a DateQuerySet -- a QuerySet that evaluates to a list of datetime.datetime objects representing all available dates of a particular kind within the contents of the QuerySet.

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


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






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






29. This gives your model metadata.






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






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






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






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






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






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






36. To activate your models






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






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






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






40. Lookup type that takes either True or False and corresponds to SQL queries of IS NULL and IS NOT NULL - respectively.






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






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






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






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






46. Evaluation happens upon use the "step" parameter of slice syntax - the first time you iterate over it - when pickling or caching results - upon calling repr() - upon calling len() - upon calling list() - upon calling bool()






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






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






49. This model type is useful if you only want to modify the Python-level behavior of a model - without changing the models fields in any way. This creates a stand-in for the original model. You can create - delete and update instances of this new model






50. Lookup type for date/datetime fields that finds an exact month match. Takes an integer 1 (January) through 12