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. a QuerySet can be sliced - using Python's array-slicing syntax.
contains
defer(*fields)
F()
slicing
2. Lookup type for date/datetime fields that finds an exact month match. Takes an integer 1 (January) through 12
month
Model metadata
Q()
==
3. 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.
db
gte
__unicode__()
delete()
4. 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
~
DoesNotExist
Entry.objects.filter(id__in=[1 - 3 - 4])
none()
5. 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.
Entry.objects.filter(id__in=[1 - 3 - 4])
iexact
choices
MultipleObjectsReturned
6. If True - the table does not permit duplicate values for this field.
using(alias)
through argument
unique
when you add new apps to INSTALLED_APPS
7. This represents a collection of objects from your database. It can have zero - one or many filters.
iexact
Many-to-many relationship to self
OneToOneField
QuerySet
8. This method is more or less the opposite of defer(). You call it with the fields that should not be deferred when retrieving a model. If you have a model where almost all the fields need to be deferred - using this method to specify the complementary
pickling
create(**kwargs)
only(*fields)
annotate(args - *kwargs)
9. 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
db
Custom model methods
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
10. If this option is True - Django will store empty values as NULL in the database. Default is False.
null
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
exclude(**kwargs)
Entry.objects.filter(id__gt=4)
11. This query finds all entries with an id in the list [1 - 3 - 4]
Q()
many-to-one relationship
save()
Entry.objects.filter(id__in=[1 - 3 - 4])
12. Defined by a ManyToManyField. You use it just like any other Field type: by including it as a class attribute of your model.
primary_key
many-to-many relationship
count()
slicing
13. The default for this is the name of the child class followed by '_set'.
Model metadata
reverse name
exact
none()
14. 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
15. Lookup type that tests for inclusion in a case-sensitive fashion.
contains
db
DoesNotExist
~
16. This query finds all entries with an id greater than 4.
help_text
F()
get_absolute_url()
Entry.objects.filter(id__gt=4)
17. 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
18. 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
19. If True - this field is the primary key for the model.
week_day
Field lookups
primary_key
save()
20. A convenience method for constructing an object and saving it all in one step.
range
model
gte
create(**kwargs)
21. This model method is used for updating a ManyToManyField.
gte
add()
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
all()
22. These are specified as keyword arguments to the QuerySet methods filter() - exclude() and get(). These take the form field__lookuptype=value .
many-to-many relationship
model
one-to-one relationship
Field lookups
23. Lookup type that returns results with a case-insensitive end sequence.
Entry.objects.filter(id__gt=4)
Many-to-many relationship through an intermediate model
all()
iendswith
24. Lookup type that returns results less than or equal to a given value.
Manager
clear() method
Manager methods
lte
25. This field is added automatically - but this behavior can be overridden
startswith
dates(field - kind - order='ASC')
id field
Field lookups
26. Lookup type that returns results less than a given value.
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
iendswith
lt
all()
27. When to run syncdb
add()
unique
filter chaining
when you add new apps to INSTALLED_APPS
28. 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.
null
id field
exists()
reverse()
29. 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
Proxy model
get(**kwargs)
using(alias)
clear() method
30. Lookup type that finds a case-insensitive regular expression match.
one-to-one relationship
startswith
iregex
update()
31. 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
OneToOneField
filter(**kwargs)
all()
select_related()
32. 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.
Q(question__istartswith='What')
through argument
Field lookups
help_text
33. This model method saves a model instance to the database. This method has no return value.
gte
one-to-one relationship
get_absolute_url()
save()
34. 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.
Manager
Field lookups
choices tuple
lt
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.
when you add new apps to INSTALLED_APPS
week_day
Entry.objects.filter(pub_date__range=(start_date - end_date))
order_by(*fields)
36. 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
only(*fields)
reverse()
intermediate models
delete()
37. Conjuntion operator for Q objects.
defer(*fields)
lte
&
relationship spanning
38. Lookup type that returns results greater than or equal to a given value.
related_name
ordered
all()
gte
39. Lookup type that returns results in a given list.
db
all()
in
Many-to-many relationship to self
40. Disjunction operator for Q objects.
Field lookups
all()
|
delete()
41. 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.
choices
F()
|
search
42. Returns the most recent object in the table - by date - using the field_name provided as the date field.
filter(**kwargs)
|
filter chaining
latest(field_name=None)
43. 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)
relationship spanning
Model metadata
only(*fields)
QuerySet
44. 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.
many-to-one relationship
iterator()
Multi-table inheritance
Model metadata
45. This gives your model metadata.
Field lookups
Manager
Meta class
choices tuple
46. 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
through argument
many-to-one relationship
DoesNotExist
Manager
47. 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
48. Returns a ValuesQuerySet -- a QuerySet that returns dictionaries when used as an iterable - rather than model-instance objects.
istartswith
latest(field_name=None)
values(*fields)
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
49. This query finds all entries between a start date of start_date and an end date of end_date.
null
Entry.objects.filter(pub_date__range=(start_date - end_date))
in_bulk(id_list)
Many-to-many relationship to self
50. A QuerySet is iterable - and it executes its database query the first time you iterate over it.
unique
evaluation
Manager
iteration
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