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. Defined by a ManyToManyField. You use it just like any other Field type: by including it as a class attribute of your model.






2. Used to get a QuerySet for a model. This is called 'objects' by default.






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






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






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






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






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






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






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






10. Lookup type for date/datetime fields that finds an exact day match.






11. This gives your model metadata.






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






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






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






15. Specifies the model that will be used to govern the many-to-many relationship. You can then put extra fields on the intermediate model. The intermediate model is associated with the ManyToManyField using this to point to the model that will act as an






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






17. To activate your models






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






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






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






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


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






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






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






25. This model method saves a model instance to the database. This method has no return value.






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






27. Defined by django.db.models.ForeignKey. You use it just like any other Field type: by including it as a class attribute of your model.






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






29. Performs an SQL delete query on all rows in the QuerySet. This method is applied instantly. You cannot call this method on a QuerySet that has had a slice taken or can otherwise no longer be filtered.






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






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






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






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






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






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






36. A QuerySet is iterable - and it executes its database query the first time you iterate over it.






37. Disjunction operator for Q objects.






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


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






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






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






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






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






44. (1) These cannot be Python reserved words - because that would result in a Python syntax error. (2) These cannot contain more than one underscore in a row - due to the way Django's query lookup syntax works.






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






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






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






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






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






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