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 manager method that returns a new QuerySet containing objects that do not match the given lookup parameters.
QuerySet
exclude(**kwargs)
get(**kwargs)
in
2. To activate your models
clear() method
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
iendswith
blank
3. 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
get(**kwargs)
intermediate models
Model metadata
annotate(args - *kwargs)
4. 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.
__unicode__()
ManyToManyField
endswith
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
5. Keyword shortcut for looking up an object by primary key.
year
ManyToManyField
pk
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
6. If this option is True - the field is allowed to be blank. Default is False.
iendswith
blank
using(alias)
Q()
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.
values_list(*fields)
OneToOneField
primary_key
==
8. 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.
lte
class attributes
help_text
choices
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()
when you add new apps to INSTALLED_APPS
update(**kwargs)
Q()
10. 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
many-to-many relationship
iterator()
null
intermediate models
11. The database that will be used if this query is executed now
db
latest(field_name=None)
in_bulk(id_list)
ordered
12. This field is added automatically - but this behavior can be overridden
default
id field
range
DoesNotExist
13. Returns the most recent object in the table - by date - using the field_name provided as the date field.
many-to-one relationship
latest(field_name=None)
null
related_name
14. Lookup type that returns results with a case-sensitive end sequence.
&
pickling
null
endswith
15. This query finds all entries between a start date of start_date and an end date of end_date.
defer(*fields)
reverse()
startswith
Entry.objects.filter(pub_date__range=(start_date - end_date))
16. Used to get a QuerySet for a model. This is called 'objects' by default.
Manager
lte
regex
create(**kwargs)
17. 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
18. 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.
endswith
Q(question__istartswith='What')
lte
ForeignKey
19. Lookup type that returns results that fall into an inclusive date range.
intermediate models
range
pickling
year
20. These methods are intended to do "table-wide" things.
in_bulk(id_list)
slicing
month
Manager methods
21. If True - this field is the primary key for the model.
primary_key
Meta class
none()
==
22. 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.
extra(select=None - where=None - params=None - tables=None - order_by=None - select_params=None)
==
using(alias)
class attributes
23. Returns a new QuerySet that uses SELECT DISTINCT in its SQL query. This eliminates duplicate rows from the query results.
distinct()
Abstract base class
class type
gt
24. Manager method used to retrieve every object in a model.
all()
count()
Q()
choices
25. 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
default
MultipleObjectsReturned
select_related()
iexact
26. This model method saves a model instance to the database. This method has no return value.
only(*fields)
Manager methods
save()
all()
27. 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
class attributes
only(*fields)
pickling
filter(**kwargs)
28. Lookup type that returns results with a case-insensitive start sequence.
update(**kwargs)
QuerySet
istartswith
get(**kwargs)
29. 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.
endswith
all()
help_text
OneToOneField
30. Lookup type that takes either True or False and corresponds to SQL queries of IS NULL and IS NOT NULL - respectively.
iterator()
null
Model metadata
isnull
31. 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
&
dates(field - kind - order='ASC')
month
32. A QuerySet is iterable - and it executes its database query the first time you iterate over it.
filter chaining
help_text
filter
iteration
33. Lookup type for date/datetime fields that finds an exact year match. Takes a four-digit year.
year
delete()
lt
add()
34. If True - the table does not permit duplicate values for this field.
when you add new apps to INSTALLED_APPS
startswith
reverse()
unique
35. Lookup type that finds a case-insensitive regular expression match.
add()
ManyToManyField
clear() method
iregex
36. 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
37. 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
|
distinct()
none()
many-to-one relationship
38. Fields are specified by these
related_name
iteration
search
class attributes
39. 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
Abstract base class
Entry.objects.filter(pub_date__year=2005).delete()
search
primary_key
40. Returns a ValuesQuerySet -- a QuerySet that returns dictionaries when used as an iterable - rather than model-instance objects.
filter(**kwargs)
blank
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
values(*fields)
41. Returns the object matching the given lookup parameters
latest(field_name=None)
none()
get(**kwargs)
ForeignKey
42. 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
range
Restrictions on field names
order_by(*fields)
43. Performs an SQL update query for the specified fields - and returns the number of rows affected. This method is applied instantly and the only restriction on the QuerySet that is updated is that it can only update columns in the model's main table. F
through argument
update(**kwargs)
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
Meta class
44. 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
defer(*fields)
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
model
delete()
45. Operator for comparing two model instances for equality. Behind the scenes - it compares the primary key values of two models.
year
filter(**kwargs)
help_text
==
46. This method immediately deletes the object and has no return value.
class attributes
delete()
evaluation
save()
47. Lookup type for date/datetime fields that finds an exact day match.
get_absolute_url()
&
day
update()
48. A manager method which returns a single object. If there are no results that match the query - this method will raise a DoesNotExist exception. If more than one item matches this query - the method will raise MultipleObjectsReturned.
gte
order_by(*fields)
Entry.objects.filter(pub_date__range=(start_date - end_date))
get(**kwargs)
49. This model method is used for updating a ManyToManyField.
when you add new apps to INSTALLED_APPS
delete()
~
add()
50. This represents a collection of objects from your database. It can have zero - one or many filters.
QuerySet
Field lookups
filter(**kwargs)
DoesNotExist
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