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 many-to-many relationship. You use it just like any other Field type: by including it as a class attribute of your model.
related_name
relationship spanning
F()
ManyToManyField
2. These methods are intended to do "table-wide" things.
istartswith
id field
Manager methods
Abstract base class
3. 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
ManyToManyField
lte
blank
exists()
4. 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
delete()
update(**kwargs)
Many-to-many relationship to self
default
5. 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.
evaluation
related_name
values_list(*fields)
values(*fields)
6. When to run syncdb
when you add new apps to INSTALLED_APPS
MultipleObjectsReturned
blank
ForeignKey
7. This query finds all entries with an id in the list [1 - 3 - 4]
Entry.objects.filter(id__in=[1 - 3 - 4])
latest(field_name=None)
__unicode__()
select_related()
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()
exclude(**kwargs)
Restrictions on field names
primary_key
9. A convenience method for constructing an object and saving it all in one step.
Q()
through argument
create(**kwargs)
class attributes
10. If True - the table does not permit duplicate values for this field.
Entry.objects.all().update(n_pingbacks=F('n_pingbacks') + 1)
unique
ManyToManyField
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
11. Each one of these is a Python class that subclasses django.db.models.Model. Each attribute of one of these represents a database field.
model
order_by(*fields)
search
filter chaining
12. 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
contains
class attributes
month
13. what the field _______ determines: (1) The database column type (e.g. INTEGER - VARCHAR); (2) The widget to use in Django's admin interface - if you care to use it (e.g. <input type="text"> - <select>); (3) The minimal validation requirements - used
year
get_absolute_url()
OneToOneField
class type
14. 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.
Restrictions on field names
values_list(*fields)
in_bulk(id_list)
pickling
15. Can be used to remove all many-to-many relationships for an instance
default
only(*fields)
clear() method
delete()
16. Lookup type that yields a case-insensitive match.
Entry.objects.filter(pub_date__year=2005).delete()
null
iexact
search
17. 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.
filter(**kwargs)
Manager methods
OneToOneField
get(**kwargs)
18. 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
pickling
DoesNotExist
search
19. To activate your models
contains
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
Many-to-many relationship through an intermediate model
istartswith
20. a QuerySet can be sliced - using Python's array-slicing syntax.
in
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
Manager
slicing
21. Lookup type that returns results less than or equal to a given value.
ManyToManyField
lte
week_day
search
22. 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
related_name
edit your settings file and change the INSTALLED_APPS setting to add the name of the module that contains your models.py.
F()
null
23. These are specified as keyword arguments to the QuerySet methods filter() - exclude() and get(). These take the form field__lookuptype=value .
search
none()
Entry.objects.filter(pub_date__range=(start_date - end_date))
Field lookups
24. 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.
relationship spanning
OneToOneField
ForeignKey
|
25. 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
iterator()
pk
all()
clear() method
26. Operator for comparing two model instances for equality. Behind the scenes - it compares the primary key values of two models.
==
count()
__unicode__()
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
27. Lookup type that tests for inclusion in a case-sensitive fashion.
primary_key
__unicode__()
contains
select_related()
28. This query deletes all Entry objects with a pub_date year of 2005.
only(*fields)
in_bulk(id_list)
Entry.objects.filter(pub_date__year=2005).delete()
lte
29. If True - this field is the primary key for the model.
DoesNotExist
Meta class
primary_key
Q()
30. Used to get a QuerySet for a model. This is called 'objects' by default.
class attributes
many-to-many relationship
Manager
iexact
31. This query finds all entries between a start date of start_date and an end date of end_date.
get(**kwargs)
Entry.objects.filter(pub_date__range=(start_date - end_date))
endswith
values(*fields)
32. 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
contains
in
day
through argument
33. Keyword shortcut for looking up an object by primary key.
Entry.objects.filter(id__in=[1 - 3 - 4])
order_by(*fields)
Abstract base class
pk
34. 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
db
aggregate(args - *kwargs)
intermediate models
Abstract base class
35. Lookup type for date/datetime fields that finds an exact month match. Takes an integer 1 (January) through 12
month
Q(question__istartswith='What')
id field
get(**kwargs)
36. A QuerySet is iterable - and it executes its database query the first time you iterate over it.
pk
iterator()
iteration
exact
37. This model method is used for updating a ManyToManyField.
add()
Q()
none()
create(**kwargs)
38. Manager method used to retrieve every object in a model.
all()
Q(question__istartswith='What')
intermediate models
delete()
39. This is a criterion that narrow down a QuerySet based on given parameters.
month
in_bulk(id_list)
annotate(args - *kwargs)
filter
40. 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
41. If you are using this attribute on a ForeignKey or ManyToManyField - you must always specify a unique reverse name for the field.
related_name
pk
startswith
Manager
42. A Python "magic method" that returns a unicode "representation" of any object.
__unicode__()
reverse name
unique
|
43. This model method saves a model instance to the database. This method has no return value.
blank
save()
iterator()
annotate(args - *kwargs)
44. 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
45. The database that will be used if this query is executed now
day
db
Field lookups
dates(field - kind - order='ASC')
46. 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)
reverse name
Model metadata
choices
related_name
47. 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
many-to-many relationship
default
Proxy model
through argument
48. This sets a field to a particular value for all the objects in a QuerySet. You can only set non-relation fields and ForeignKey fields using this method.
values(*fields)
Entry.objects.all().update(n_pingbacks=F('n_pingbacks') + 1)
update()
relationship spanning
49. Lookup type that returns results less than a given value.
all()
lt
Manager
in
50. Lookup type that finds a case-insensitive regular expression match.
iregex
|
get(**kwargs)
add()
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