1. What is the command to start Django's built-in development server?
2. What is the definition of a Django Project?
3. What is the Django shortcut method to more easily render an html response?
4. What is the correct syntax for including a class based view in a URLconf?
5. What is the definition of a good Django app?
6. What is the purpose of settings.py?
7. Django is written using what programming language?
8. What does a urls.py file do in Django?
9. What is the command to run Django's development server on port 8080 on IP address 12.34.56.78?
10. After you make a new 'app' in your existing Django project, how do you get Django to notice it?
11. What is the Django command to start a new app named 'users' in an existing project?
12. What is the most easiest, fastest, and most stable deployment choice in most cases with Django?
13. How do you define a 'name' field in a Django model with a maximum length of 255 characters?
14. What preferred method do you add to a Django model to get a better string representation of the model in the Django admin?
15. How do you exclude a specific field from a ModelForm?
16. What is ModelForm used for?
17. Assuming you have a Django model named 'User', how do you define a foreign key field for this model in another model?
18. Assuming you've imported the proper Django model file, how do you add a 'User' model to the Django admin?
19. What happens if MyObject.objects.get() is called with parameters that do not match an existing item in the database?
20. How to make django timezone-aware?
21. What is the command to start a new Django project called 'myproject'?
22. In Django how would you retrieve all the 'User' records from a given database?
23. A set of helpful applications to use within your Django projects is included in the official distribution. This module is called what?
24. What does the Django command `manage.py shell` do?
25. How can you define additional behavior and characteristics of a Django class?
26. Where is pre_save signal in Django
27. What is Dijit?
28. What does the Django command `manage.py validate` do?
29. What is the correct way to include django's admin urls? from django.contrib import admin') from django.conf.urls import patterns, include, url urlpatterns = patterns('', ______________________ )
30. What is the purpose of the STATIC_ROOT setting?
31. Given the Python data: mydata = [ [ 0, 'Fred' ], [ 1, 'Wilma' ] ] How do you access the data in a Django template?
32. Given an IntegerField named 'widgets' in the Django model 'User' , how do you calculate the average number of widgets per user?
33. Given a model named 'User' that contains a DateTime field named 'last_login', how do you query for users that have never logged in?
34. What is the Django command to view a database schema of an existing (or legacy) database?
35. Given a model named 'User' that contains a field named 'email', how do you perform a case-insensitive exact match for the email '[email protected]'?
36. What command compile Django's translation files?
37. Given a form with field foo, what should the validation method for this field be called?
38. You have created a Form class and wish to provide custom logic for validating the input in the "foo" field. What would you name your custom validation method?
39. What is the Django command to retrieve the first 10 'User' records from your database sorted by name descending?
40. How to create a DateTimeField named created and filled in only on the creation with the current time?
41. You can handle multiple Django forms with what keyword argument when creating forms?
42. When customizing validation in a Form subclass named MyForm, how do you add an error message that is displayed as a form-wide error?
43. What command do you use to alter the fields Django displays for a given model in the Django admin ListView?
44. What is the command used to print the CREATE TABLE SQL statements for the given app name?
45. In settings.py, when DEBUG is set to ________, Django will email unhandled exceptional conditions.
46. You have a Form defined with "password" and "confirm_password" fields. In what method of the "form" object would you validate that the values supplied in these fields match?
47. How do you create a recursive relationship in a model class named 'Company' in Django?
48. Which class is a model field representing a path to a server-based image file?
49. Which of these can be used to retrieve a setting from the settings module, and provide a default if the setting is not defined?
50. The Benevolent Dictators for Life of the Django Project are:
51. The django.contrib.contenttypes application provides
52. In your django template, if you need to get the content of the block from the django parent template, what do you need to add? {% block my_block %} ___________ {% endblock %}
53. Which type of custom template tag returns a string?
54. How to set a default order by in your Django model ? YourModel.objects.all() will be ordered by default without calling order_by() method
55. A model's "full_clean()" method is called automatically when you call your model's "save()" method.
56. Given a model named 'User' that contains a CharField 'name', how do you query for users whose name starts with 'Fred' or 'Bob'?
57. How would you perform a lookup on a model against a database aside from the default?
58. Which model field type does NOT exist in Django?
59. How would you create a ForeignKey from a model named Transaction, to a model named Product, with no reverse relation?
60. What datetime formatting would you apply in a template to display the following: 2013/03/20 8:00:06 AM ?
61. What is the name of the Django decorator that hides sensitive info from error reports?
62. By using django.contrib.humanize, you can use the following filter in your template to display the number 3 as three.
63. How is the ManyToManyField represented in Django model form?
64. Which one is NOT used to represent ManyToManyField in django model form?
65. Correct way to specify the fields to use in a Model Form?
66. What is the exception raised if you are using POST against this function?
67. Correct way to insert csrf token for forms in django template?
68. Which Django core function can be used to send an email?
69. Using a template tag you tried to load a templatetag as in {% load poll_extras %} and it failed, what could be the problem ?
70. Correct ways to add a message?
71. What does setting SESSION_COOKIE_SECURE = True do?
72. Django is a web __ in Python to develop a web application.
73. How can you set up static files in Django?
74. Correct way to allow empty value in Integer Field?
75. What is the exception raised when a duplicate value is used in unique field while inserting a record?
76. Which feature is supported by Django?
77. Correct way to specify a translation string?
78. Which caching strategies can be implemented in Django?
79. Which caching strategies are supported in Django?
80. What is the full form of FBV and CBV?
81. Which is NOT used as a server for django in production?
82. Which is true about generators?
83. Which decorators are used to restrict authentication of users? Note: There may be more than one right answer.
84. Correct way to create a superuser from command line?
85. Which method is not used in django ListView?
86. Which attribute is used to order the objects in django admin?
87. Which query gives the count of vehicles that are private?
88. Which data structure is used to pass context values from views to template?
89. How would you iterate through a list called my_list in template ?
90. Which template tag is used to add another template to the current one?
91. Which class uses an HTTP 304 status code?
92. Which is not a layer in Django?
93. Which is not True?
94. What kind of relation is defined between models A and B by invoking ForeignKey(A) in the class definition for model B?
95. Which command runs all test in a django project?
96. Which is not true about testing?
97. Name of the command line tool that Django provides for managing a newly created project and its applications?
98. What is true about the management command collectstatic?
99. Which url pattern is used to register admin url?
100. Which is determined by Django using field class types?
101. Which statement is true about the QuerySet select_related() method?
102. What is TRUE about django-admin.py makemessages command?
103. Correct way to allow empty value in CharField?
104. Which is a possible usage of middlewares in Django?
105. Which is built-in signal provided by Django?
106. Which will not register a model 'Test' to Django admin?
107. Which is NOT correct about Django Models?
108. What is the exception raised when the object is not found while performing the following query?
109. What is the exception raised for this query Entry.objects.filter(blog_id=4)?
110. What is the table name for model named Choice in application question?
111. Which method is allowed in django Listview?
112. What command line can be used to load data into Django?
113. Which one is valid built-in signal provided by django?
114. Which query includes a shirt with size 40?
115. Which types of users are allowed to login to the django administration site?
116. How would you check if a list my_list is empty or not in template ?
117. Which statement is true to get a Queryset of all Entries which were published before 2006?
118. Correct way to start a new app inside a django project?
119. Which is not a built-in Django template loader class?
120. Which get called when a view raises an exception?
121. Which is true for model field names?
122. Correct way to Abstract Model class?
123. Correct way to randomly order a queryset?
124. Django is written in
125. Which database is not supported by Django ORM?
126. Which form method binds the data in the URL and is passed to the view?
127. Which template command makes a custom template tag/filter available in template?
128. Assume a, b, c, d and e are variables which hold some random integer from 1 to 10. Which is NOT correct in django template?
129. If an instance of a form is named ‘form’, which attribute of form instance holds all validated form data?
130. How do you inherit the A.html template in B.html template?
131. How can you access a variable in template which is passed from view? Suppose the variable name is object.
132. Which command will make changes in the database tables schema?
133. What is the default max_length value of a SlugField class in Django?
134. Which statement is true about the django.template.RequestContext class?
135. Best way to extend the Django user model with extra custom fields in addition to the fields already provided?
136. Check all True facts about Django. Note: There may be more than one right answer.
137. Which statement is true about the ImageField class? Note: There may be more than one right answer.
138. Which is not a predefined log level in Django?
139. A circuit has an output that is determined by the present input as well as the previous output states. The circuit is known as _____.
140. To cache your entire site for an application in Django, you add all except which of these settings?
141. In which programming language is Django written?
142. To automatically provide a value for a field, or to do validation that requires access to more than a single field, you should override the ___ method in the ___ class.
143. How do you determine at startup time if a piece of middleware should be used?
144. How do you turn off Django’s automatic HTML escaping for part of a web page?
145. Which step would NOT help you troubleshoot the error "django-admin: command not found"?
146. Every time a user is saved, their quiz_score needs to be recalculated. Where might be an ideal place to add this logic?
147. What is the correct way to begin a class called "Rainbow" in Python?
148. You have inherited a Django project and need to get it running locally. It comes with a requirements.txt file containing all its dependencies. Which command should you use?
149. Which best practice is NOT relevant to migrations?
150. What will this URL pattern match? url(r'^$', views.hello)
151. What is the typical order of an HTTP request/response cycle in Django?
152. Django's class-based generic views provide which classes that implement common web development tasks?
153. Which skills do you need to maintain a set of Django templates?
154. Which is NOT a valid step in configuring your Django 2.x instance to serve up static files such as images or CSS?
155. What is the correct way to make a variable available to all of your templates?
156. Should you create a custom user model for new projects?
157. You want to create a page that allows editing of two classes connected by a foreign key (e.g., a question and answer that reside in separate tables). What Django feature can you use?
158. Why are QuerySets considered "lazy"?
159. You receive a MultiValueDictKeyError when trying to access a request parameter with the following code: request.GET['search_term']. Which solution will NOT help you in this scenario?
160. Which function of Django's Form class will render a form's fields as a series of tags?
161. You have found a bug in Django and you want to submit a patch. Which is the correct procedure?
162. Django supplies sensible default values for settings. In which Python module can you find these settings?
163. Which variable name is best according to PEP 8 guidelines?
164. A project has accumulated 500 migrations. Which course of action would you pursue?
165. What does an F() object allow you when dealing with models?
166. Which is not a Django filed type for integers?
167. Which will show the currently installed version?
168. You should use the http method ___ to read data and ___ to update or create data
169. When should you employ the POST method over GET for submitting data?
170. When to use the Django sites framework?
171. Which infrastructure do you need: title=models.charfield(max_length=100, validators=[validate_spelling])
172. What decorator is used to require that a view accepts only the get and head methods?
173. What is a callable that takes a value and raises an error if the value fails?
174. To secure an API endpoint, making it accessible to registered users only, you can replace the rest_framework.permissions.allowAny value in the default_permissions section of your settings.py to
175. Which command would you use to apply a migration?
176. Which type of class allows QuerySets and model instances to be converted to native Python data types for use in APIs?
177. Which class allows you to automatically create a Serializer class with fields and validators that correspond to your model's fields?
178. Which command to access the built-in admin tool for the first time?
179. Virtual environments are for managing dependencies. Which granularity works best?
180. What executes various Django commands such as running a webserver or creating an app?
181. What do Django best practice suggest should be "fat"?
182. Which is not part of Django's design philosophy?
183. What is the result of this template code? {{"live long and prosper"|truncate:3}}
184. To expose an existing model via an API endpoint, what do you need to implement?**
185. How would you stop Django from performing database table creation or deletion operations via migrations for a particular model?**
186. What method can you use to check if form data has changed when using a form instance?
187. What is WSGI?
188. Which generic view should be used for displaying the tittles of all Django Reinhardt's songs?
189. Which statement is most accurate, regarding using the default SQLite database on your local/development machine but Postgres in production
190. Why might you want to write a custom model Manager?
191. In Django, what are used to customize the data that is sent to the templates?
192. When should you employ the POST method over the GET method for submitting data from a form?
193. What is a callable that takes a value and raises an error if the value fails to meet some criteria?
194. You are uploading a file to Django from a form and you want to save the received file as a field on a model object. You can simply assign the file object from**_to a field of type__**in the model.
195. What python module might be used to store the current state of a Django model in a file?
196. To add a new app to an existing Django project, you must edit the _ section of the _ file.
197. Which is not a third-party package commonly used for authentication?
198. Which function in the django.urls package can help you avoid hardcoding URLS by generating a URL given the name of a view?
199. Which is Fictional HTTP request method?