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. Lookup type that returns results with a case-insensitive end sequence.
choices
iendswith
Multi-table inheritance
istartswith
2. A convenience method for constructing an object and saving it all in one step.
annotate(args - *kwargs)
create(**kwargs)
none()
F()
3. Returns the most recent object in the table - by date - using the field_name provided as the date field.
Model metadata
filter(**kwargs)
delete()
latest(field_name=None)
4. 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
5. This model method saves a model instance to the database. This method has no return value.
Entry.objects.all().update(n_pingbacks=F('n_pingbacks') + 1)
save()
search
intermediate models
6. Returns a new QuerySet that uses SELECT DISTINCT in its SQL query. This eliminates duplicate rows from the query results.
startswith
reverse()
distinct()
related_name
7. a QuerySet can be sliced - using Python's array-slicing syntax.
slicing
Entry.objects.filter(id__gt=4)
annotate(args - *kwargs)
values_list(*fields)
8. Lookup type that returns results less than or equal to a given value.
lte
many-to-many relationship
add()
month
9. If you are using this attribute on a ForeignKey or ManyToManyField - you must always specify a unique reverse name for the field.
related_name
search
only(*fields)
lt
10. Returns True if the QuerySet contains any results - and False if not. This tries to perform the query in the simplest and fastest way possible - but it does execute nearly the same query. This means that calling this method on a queryset is faster th
Multi-table inheritance
exists()
get_absolute_url()
QuerySet
11. 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.
in_bulk(id_list)
many-to-one relationship
&
pk
12. 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
annotate(args - *kwargs)
iendswith
many-to-one relationship
range
13. Lookup type that returns results greater than a given value.
gt
Manager
pickling
Entry.objects.all().update(n_pingbacks=F('n_pingbacks') + 1)
14. This query finds all entries with an id greater than 4.
__unicode__()
istartswith
Entry.objects.filter(id__gt=4)
reverse()
15. This query finds all entries with an id in the list [1 - 3 - 4]
Abstract base class
related_name
==
Entry.objects.filter(id__in=[1 - 3 - 4])
16. This query deletes all Entry objects with a pub_date year of 2005.
Entry.objects.filter(pub_date__year=2005).delete()
help_text
ForeignKey
values(*fields)
17. Defined by a OneToOneField. You use it just like any other Field type: by including it as a class attribute of your model.
range
one-to-one relationship
ordered
endswith
18. Lookup type that returns results that fall into an inclusive date range.
exclude(**kwargs)
reverse name
range
startswith
19. When to run syncdb
|
QuerySet
when you add new apps to INSTALLED_APPS
filter(**kwargs)
20. 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.
Entry.objects.filter(pub_date__range=(start_date - end_date))
day
ForeignKey
all()
21. Returns an integer representing the number of objects in the database matching the QuerySet. This never raises exceptions.
aggregate(args - *kwargs)
filter(**kwargs)
Proxy model
count()
22. This represents a collection of objects from your database. It can have zero - one or many filters.
&
|
QuerySet
in
23. A manager method that returns a new QuerySet containing objects that do not match the given lookup parameters.
filter chaining
year
iteration
exclude(**kwargs)
24. 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.
filter
day
ForeignKey
delete()
25. 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.
ManyToManyField
count()
gt
all()
26. Lookup type for date/datetime fields that finds an exact day match.
gte
week_day
Many-to-many relationship to self
day
27. Lookup type that returns results greater than or equal to a given value.
latest(field_name=None)
gte
dates(field - kind - order='ASC')
order_by(*fields)
28. 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.
filter chaining
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
Many-to-many relationship through an intermediate model
gt
29. The database that will be used if this query is executed now
db
Manager methods
save()
model
30. 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
clear() method
update()
class type
defer(*fields)
31. These add custom "row-level" functionality to your objects. These act on a particular model instance.
Custom model methods
pk
iregex
~
32. 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.
values(*fields)
all()
reverse name
choices tuple
33. These are specified as keyword arguments to the QuerySet methods filter() - exclude() and get(). These take the form field__lookuptype=value .
class type
week_day
id field
Field lookups
34. Lookup type for date/datetime fields that finds an exact year match. Takes a four-digit year.
year
update(**kwargs)
choices tuple
latest(field_name=None)
35. 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
month
gt
F()
startswith
36. 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)
create(**kwargs)
day
Model metadata
values(*fields)
37. Operator for comparing two model instances for equality. Behind the scenes - it compares the primary key values of two models.
ordered
==
iendswith
count()
38. Negation operator for Q objects.
~
|
search
delete()
39. Lookup type that tests for inclusion in a case-sensitive fashion.
endswith
save()
default
contains
40. Lookup type for date/datetime fields that finds a 'day of the week' match.
many-to-one relationship
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
week_day
==
41. Used to get a QuerySet for a model. This is called 'objects' by default.
Entry.objects.filter(id__gt=4)
Manager
get_or_create(**kwargs)
annotate(args - *kwargs)
42. 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
43. 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
range
search
class type
44. A QuerySet is iterable - and it executes its database query the first time you iterate over it.
Many-to-many relationship to self
many-to-one relationship
iteration
evaluation
45. 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()
class attributes
lt
update(**kwargs)
evaluation
46. Manager method used to retrieve every object in a model.
|
iteration
all()
Entry.objects.filter(id__gt=4)
47. Can be used to remove all many-to-many relationships for an instance
class type
reverse name
all()
clear() method
48. 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.
defer(*fields)
Abstract base class
using(alias)
pickling
49. 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.
Field lookups
Model metadata
get_absolute_url()
==
50. This is a criterion that narrow down a QuerySet based on given parameters.
create(**kwargs)
filter
year
Model metadata
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