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 query finds all entries between a start date of start_date and an end date of end_date.






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






3. Each one of these is a Python class that subclasses django.db.models.Model. Each attribute of one of these represents a database field.






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






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






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






7. To activate your models






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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


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






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. Returns a ValuesQuerySet -- a QuerySet that returns dictionaries when used as an iterable - rather than model-instance objects.






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






45. This method returns tuples of values when iterated over. Each tuple contains the value from the respective field passed into the call to this method -- so the first item is the first field - etc.






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






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






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






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






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






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