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 is iterable - and it executes its database query the first time you iterate over it.
iteration
update()
week_day
Q(question__istartswith='What')
2. 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.
|
choices
__unicode__()
Field lookups
3. 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.
add()
Many-to-many relationship to self
many-to-one relationship
Multi-table inheritance
4. This is a criterion that narrow down a QuerySet based on given parameters.
default
all()
filter
relationship spanning
5. Fields are specified by these
class attributes
in_bulk(id_list)
defer(*fields)
create(**kwargs)
6. 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()
all()
F()
Manager methods
7. 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.
help_text
get(**kwargs)
choices
values_list(*fields)
8. 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.
delete()
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
update(**kwargs)
iendswith
9. This query finds all entries with an id in the list [1 - 3 - 4]
month
class attributes
Entry.objects.filter(id__in=[1 - 3 - 4])
related_name
10. 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
11. This method immediately deletes the object and has no return value.
day
delete()
Multi-table inheritance
class type
12. 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
all()
iendswith
iterator()
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
13. Lookup type for date/datetime fields that finds a 'day of the week' match.
Manager methods
pickling
week_day
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
14. 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.
default
choices tuple
Manager
slicing
15. This method is for controlling which database the QuerySet will be evaluated against if you are using more than one database. The only argument this method takes is the alias of a database - as defined in DATABASES.
related_name
using(alias)
aggregate(args - *kwargs)
Entry.objects.filter(id__gt=4)
16. 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.
dates(field - kind - order='ASC')
Multi-table inheritance
Entry.objects.filter(pub_date__year=2005).delete()
aggregate(args - *kwargs)
17. 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
18. Exception raised by get(**kwargs) if no items match the query.
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
DoesNotExist
regex
day
19. Lookup type that returns results less than a given value.
all()
relationship spanning
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
lt
20. 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.
Entry.objects.filter(id__gt=4)
create(**kwargs)
reverse()
relationship spanning
21. The database that will be used if this query is executed now
exact
get_absolute_url()
add()
db
22. Keyword shortcut for looking up an object by primary key.
through argument
pk
get_absolute_url()
lte
23. If this option is True - the field is allowed to be blank. Default is False.
blank
MultipleObjectsReturned
many-to-one relationship
none()
24. Lookup type that returns results with a case-insensitive end sequence.
iendswith
Entry.objects.filter(id__in=[1 - 3 - 4])
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
update()
25. This object encapsulates a collection of keyword arguments - with the keys being field lookup types. These objects can be combined using the & and | operators - as well as negated with the ~ operator.
select_related()
Entry.objects.filter(id__gt=4)
Q()
QuerySet
26. 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.
in
many-to-one relationship
day
OneToOneField
27. A Manager method that returns a new QuerySet containing objects that match the given lookup parameters.
filter(**kwargs)
add()
range
annotate(args - *kwargs)
28. Lookup type that returns results with a case-insensitive start sequence.
istartswith
search
Meta class
primary_key
29. Lookup type for date/datetime fields that finds an exact day match.
Entry.objects.filter(pub_date__range=(start_date - end_date))
Entry.objects.filter(pub_date__year=2005).delete()
day
none()
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.
many-to-many relationship
in_bulk(id_list)
Meta class
startswith
31. These add custom "row-level" functionality to your objects. These act on a particular model instance.
search
month
ordered
Custom model methods
32. If True - this field is the primary key for the model.
primary_key
week_day
filter(**kwargs)
MultipleObjectsReturned
33. Returns a new QuerySet containing objects that match the given lookup parameters.
dates(field - kind - order='ASC')
filter(**kwargs)
model
in
34. 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)
Model metadata
select_related()
update()
save()
35. This model method saves a model instance to the database. This method has no return value.
choices tuple
save()
class attributes
pickling
36. Lookup type that yields an "exact" match. If you don't provide a lookup type -- that is - if your keyword argument doesn't contain a double underscore -- the lookup type is assumed to be of this sort.
exact
Q(question__istartswith='What')
delete()
choices tuple
37. 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
all()
year
filter
pickling
38. 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
gt
slicing
none()
39. Lookup type that returns results with a case-sensitive end sequence.
filter(**kwargs)
endswith
related_name
delete()
40. If this option is True - Django will store empty values as NULL in the database. Default is False.
filter(**kwargs)
null
intermediate models
iteration
41. Lookup type that returns results in a given list.
values(*fields)
in
endswith
range
42. 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 to self
month
Field lookups
QuerySet
43. This query deletes all Entry objects with a pub_date year of 2005.
save()
id field
delete()
Entry.objects.filter(pub_date__year=2005).delete()
44. 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.
get_absolute_url()
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
relationship spanning
ManyToManyField
45. Lookup type that returns results greater than a given value.
gt
Meta class
distinct()
delete()
46. Takes the ouput of one filter and uses it as input for another filter. This works because a refinement of a QuerySet is itself a QuerySet.
filter chaining
filter(**kwargs)
lte
Restrictions on field names
47. Lookup type that returns results less than or equal to a given value.
lte
filter
dates(field - kind - order='ASC')
Model metadata
48. A manager method that returns a new QuerySet containing objects that do not match the given lookup parameters.
pickling
exclude(**kwargs)
ManyToManyField
add()
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
lte
get_or_create(**kwargs)
filter(**kwargs)
50. Returns an integer representing the number of objects in the database matching the QuerySet. This never raises exceptions.
count()
Q()
exists()
|
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