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. 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.
model
OneToOneField
exclude(**kwargs)
QuerySet
2. Lookup type that returns results in a given list.
in
class attributes
clear() method
MultipleObjectsReturned
3. a QuerySet can be sliced - using Python's array-slicing syntax.
day
slicing
year
distinct()
4. This model method is used for updating a ManyToManyField.
Q()
add()
range
filter(**kwargs)
5. Defined by a ManyToManyField. You use it just like any other Field type: by including it as a class attribute of your model.
iteration
Manager methods
many-to-many relationship
filter chaining
6. Returns an integer representing the number of objects in the database matching the QuerySet. This never raises exceptions.
add()
pickling
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
count()
7. These methods are intended to do "table-wide" things.
Manager methods
slicing
get_or_create(**kwargs)
F()
8. 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
istartswith
all()
Q(question__istartswith='What')
many-to-one relationship
9. 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
F()
Model metadata
lt
ForeignKey
10. Lookup type that returns results with a case-sensitive end sequence.
OneToOneField
endswith
db
model
11. Lookup type that returns results less than a given value.
through argument
annotate(args - *kwargs)
lt
day
12. 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.
exact
order_by(*fields)
unique
iregex
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.
DoesNotExist
Model metadata
ForeignKey
endswith
14. 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
15. Lookup type that finds a case-sensitive regular expression match.
Entry.objects.filter(id__gt=4)
regex
Meta class
exclude(**kwargs)
16. Each one of these is a Python class that subclasses django.db.models.Model. Each attribute of one of these represents a database field.
Many-to-many relationship through an intermediate model
class attributes
values(*fields)
model
17. This class type is useful when you just want to use the parent class to hold information that you don't want to have to type out for each child model. This class isn't going to ever be used in isolation. When it is used as a base class for other mode
add()
Abstract base class
Entry.objects.filter(id__gt=4)
filter(**kwargs)
18. Returns a ValuesQuerySet -- a QuerySet that returns dictionaries when used as an iterable - rather than model-instance objects.
Many-to-many relationship through an intermediate model
values(*fields)
isnull
iteration
19. 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
Proxy model
clear() method
many-to-many relationship
only(*fields)
20. Operator for comparing two model instances for equality. Behind the scenes - it compares the primary key values of two models.
Field lookups
delete()
==
add()
21. 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
22. To activate your models
in
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
model
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
23. 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
evaluation
exact
exists()
none()
24. 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.
filter(**kwargs)
get_or_create(**kwargs)
week_day
pickling
25. A convenience method for looking up an object with the given kwargs - creating one if necessary.
select_related()
none()
delete()
get_or_create(**kwargs)
26. This represents a collection of objects from your database. It can have zero - one or many filters.
help_text
null
QuerySet
get(**kwargs)
27. 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.
Entry.objects.filter(id__gt=4)
search
default
F()
28. This query finds all entries with an id greater than 4.
search
Entry.objects.filter(id__gt=4)
|
relationship spanning
29. 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.
through argument
model
default
DoesNotExist
30. 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
31. Manager method used to retrieve every object in a model.
update()
all()
one-to-one relationship
when you add new apps to INSTALLED_APPS
32. When to run syncdb
only(*fields)
Meta class
when you add new apps to INSTALLED_APPS
exists()
33. These add custom "row-level" functionality to your objects. These act on a particular model instance.
Field lookups
exclude(**kwargs)
Custom model methods
Many-to-many relationship to self
34. 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
lte
blank
get(**kwargs)
35. Returns a new QuerySet containing objects that match the given lookup parameters.
ordered
filter(**kwargs)
iregex
gt
36. Evaluation happens upon use the "step" parameter of slice syntax - the first time you iterate over it - when pickling or caching results - upon calling repr() - upon calling len() - upon calling list() - upon calling bool()
latest(field_name=None)
iexact
~
evaluation
37. If True - this field is the primary key for the model.
primary_key
Multi-table inheritance
exact
Entry.objects.filter(pub_date__year=2005).delete()
38. Sometimes - the Django query syntax by itself can't easily express a complex WHERE clause. For these edge cases - Django provides this QuerySet modifier -- a hook for injecting specific clauses into the SQL generated by a QuerySet.
reverse()
&
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
range
39. This query finds all entries between a start date of start_date and an end date of end_date.
values_list(*fields)
&
relationship spanning
Entry.objects.filter(pub_date__range=(start_date - end_date))
40. Lookup type for date/datetime fields that finds an exact year match. Takes a four-digit year.
&
year
Restrictions on field names
order_by(*fields)
41. Exception raised by get(**kwargs) if no items match the query.
year
in
ordered
DoesNotExist
42. Returns the object matching the given lookup parameters
Many-to-many relationship to self
add()
related_name
get(**kwargs)
43. A QuerySet is iterable - and it executes its database query the first time you iterate over it.
iteration
gte
order_by(*fields)
model
44. If True - the table does not permit duplicate values for this field.
ManyToManyField
OneToOneField
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
unique
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.
update()
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
values_list(*fields)
in_bulk(id_list)
46. Lookup type that returns results greater than or equal to a given value.
Q(question__istartswith='What')
Entry.objects.all().update(n_pingbacks=F('n_pingbacks') + 1)
reverse()
gte
47. 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.
in
Many-to-many relationship to self
add()
reverse()
48. Defined by a OneToOneField. You use it just like any other Field type: by including it as a class attribute of your model.
id field
one-to-one relationship
iexact
values_list(*fields)
49. 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.
choices tuple
id field
__unicode__()
year
50. 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
isnull
annotate(args - *kwargs)
in
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
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