SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
|
Email
Search
Test your basic knowledge |
Django Queryset
Start Test
Study First
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. These methods are intended to do "table-wide" things.
choices
Manager methods
values_list(*fields)
delete()
2. 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
none()
range
ForeignKey
OneToOneField
3. This query finds all entries between a start date of start_date and an end date of end_date.
Entry.objects.all().update(n_pingbacks=F('n_pingbacks') + 1)
endswith
Entry.objects.filter(pub_date__range=(start_date - end_date))
F()
4. Lookup type that returns results with a case-insensitive start sequence.
relationship spanning
pickling
ForeignKey
istartswith
5. 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.
exists()
Restrictions on field names
reverse()
blank
6. 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.
OneToOneField
annotate(args - *kwargs)
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
choices
7. This query deletes all Entry objects with a pub_date year of 2005.
Entry.objects.filter(pub_date__year=2005).delete()
Custom model methods
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
class attributes
8. 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.
Q(question__istartswith='What')
iendswith
ForeignKey
clear() method
9. If this option is True - the field is allowed to be blank. Default is False.
day
Proxy model
blank
none()
10. (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.
none()
Restrictions on field names
Proxy model
lte
11. Conjuntion operator for Q objects.
&
unique
get(**kwargs)
null
12. Lookup type that returns results with a case-sensitive start sequence.
startswith
filter
F()
latest(field_name=None)
13. A Manager method that returns a new QuerySet containing objects that match the given lookup parameters.
choices tuple
|
filter(**kwargs)
search
14. 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.
help_text
Entry.objects.all().update(n_pingbacks=F('n_pingbacks') + 1)
db
Entry.objects.filter(id__gt=4)
15. Negation operator for Q objects.
pickling
~
Q(question__istartswith='What')
Entry.objects.filter(id__gt=4)
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.
get_absolute_url()
all()
evaluation
Many-to-many relationship through an intermediate model
17. Keyword shortcut for looking up an object by primary key.
get_or_create(**kwargs)
reverse name
pk
dates(field - kind - order='ASC')
18. A Python "magic method" that returns a unicode "representation" of any object.
__unicode__()
Entry.objects.all().update(n_pingbacks=F('n_pingbacks') + 1)
using(alias)
QuerySet
19. Lookup type that returns results greater than a given value.
slicing
gt
week_day
get_absolute_url()
20. A manager method that returns a new QuerySet containing objects that do not match the given lookup parameters.
using(alias)
many-to-one relationship
exclude(**kwargs)
Custom model methods
21. 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.
~
when you add new apps to INSTALLED_APPS
order_by(*fields)
Manager methods
22. This model method saves a model instance to the database. This method has no return value.
relationship spanning
save()
iregex
lte
23. This gives your model metadata.
~
Meta class
in
ordered
24. Lookup type that finds a case-sensitive regular expression match.
regex
slicing
in
startswith
25. Used to get a QuerySet for a model. This is called 'objects' by default.
Many-to-many relationship through an intermediate model
one-to-one relationship
Manager
annotate(args - *kwargs)
26. 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.
all()
delete()
get_absolute_url()
iterator()
27. 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
iendswith
QuerySet
choices
through argument
28. Fields are specified by these
delete()
when you add new apps to INSTALLED_APPS
class attributes
get(**kwargs)
29. This model method is used for updating a ManyToManyField.
Many-to-many relationship through an intermediate model
lt
through argument
add()
30. 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.
month
delete()
in_bulk(id_list)
Entry.objects.all().update(n_pingbacks=F('n_pingbacks') + 1)
31. Lookup type that returns results with a case-sensitive end sequence.
endswith
class type
filter chaining
unique
32. Disjunction operator for Q objects.
class type
istartswith
|
QuerySet
33. 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.
using(alias)
Q(question__istartswith='What')
default
help_text
34. These add custom "row-level" functionality to your objects. These act on a particular model instance.
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
Custom model methods
Many-to-many relationship to self
update(**kwargs)
35. 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
Model metadata
istartswith
add()
iterator()
36. 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.
default
aggregate(args - *kwargs)
week_day
unique
37. This field is added automatically - but this behavior can be overridden
Meta class
id field
iterator()
filter
38. To activate your models
get(**kwargs)
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
&
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
39. 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
distinct()
many-to-one relationship
class type
F()
40. 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.
update()
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
exclude(**kwargs)
Multi-table inheritance
41. 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
DoesNotExist
clear() method
class type
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
42. 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.
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
ordered
many-to-one relationship
Q(question__istartswith='What')
43. Returns a new QuerySet containing objects that match the given lookup parameters.
week_day
order_by(*fields)
class type
filter(**kwargs)
44. Defined by a ManyToManyField. You use it just like any other Field type: by including it as a class attribute of your model.
select_related()
endswith
many-to-many relationship
Manager
45. Lookup type that returns results with a case-insensitive end sequence.
year
update()
delete()
iendswith
46. 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
47. Exception raised by get(**kwargs) if no items match the query.
DoesNotExist
update(**kwargs)
order_by(*fields)
gte
48. Each one of these is a Python class that subclasses django.db.models.Model. Each attribute of one of these represents a database field.
model
Custom model methods
year
contains
49. 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.
iterator()
choices tuple
search
year
50. A Q object that encapsulates queries for entries with a question value that starts with 'What' in a case-insensitive fashion.
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
Sorry!:) No result found.
Can you answer 50 questions in 15 minutes?
Let me suggest you:
Browse all subjects
Browse all tests
Most popular tests
Major Subjects
Tests & Exams
AP
CLEP
DSST
GRE
SAT
GMAT
Certifications
CISSP go to https://www.isc2.org/
PMP
ITIL
RHCE
MCTS
More...
IT Skills
Android Programming
Data Modeling
Objective C Programming
Basic Python Programming
Adobe Illustrator
More...
Business Skills
Advertising Techniques
Business Accounting Basics
Business Strategy
Human Resource Management
Marketing Basics
More...
Soft Skills
Body Language
People Skills
Public Speaking
Persuasion
Job Hunting And Resumes
More...
Vocabulary
GRE Vocab
SAT Vocab
TOEFL Essential Vocab
Basic English Words For All
Global Words You Should Know
Business English
More...
Languages
AP German Vocab
AP Latin Vocab
SAT Subject Test: French
Italian Survival
Norwegian Survival
More...
Engineering
Audio Engineering
Computer Science Engineering
Aerospace Engineering
Chemical Engineering
Structural Engineering
More...
Health Sciences
Basic Nursing Skills
Health Science Language Fundamentals
Veterinary Technology Medical Language
Cardiology
Clinical Surgery
More...
English
Grammar Fundamentals
Literary And Rhetorical Vocab
Elements Of Style Vocab
Introduction To English Major
Complete Advanced Sentences
Literature
Homonyms
More...
Math
Algebra Formulas
Basic Arithmetic: Measurements
Metric Conversions
Geometric Properties
Important Math Facts
Number Sense Vocab
Business Math
More...
Other Major Subjects
Science
Economics
History
Law
Performing-arts
Cooking
Logic & Reasoning
Trivia
Browse all subjects
Browse all tests
Most popular tests