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






2. Evaluates the QuerySet (by performing the query) and returns an iterator over the results. A QuerySet typically caches its results internally so that repeated evaluations do not result in additional queries; this method will instead read results dire






3. This gives your model metadata.






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






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






6. This field is added automatically - but this behavior can be overridden






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






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






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






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






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






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






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


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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






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






30. Returns the object matching the given lookup parameters






31. Can be used to remove all many-to-many relationships for an instance






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






33. Negation operator for Q objects.






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


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






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






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






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






39. Accomplish this by using the field name of related fields across models - separated by double underscores - until you get to the field you want. For example - to get all Entry objects with a Blog whose name is 'Beatles Blog': Entry.objects.filter(blo






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






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






42. Disjunction operator for Q objects.






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






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






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






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






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






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






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






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