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. What does a urls.py file do in Django?
8. After you make a new 'app' in your existing Django project, how do you get Django to notice it?
9. What is the Django command to start a new app named 'users' in an existing project?
10. What is the most easiest, fastest, and most stable deployment choice in most cases with Django?
11. What is ModelForm used for?
12. Assuming you have a Django model named 'User', how do you define a foreign key field for this model in another model?
13. What happens if MyObject.objects.get() is called with parameters that do not match an existing item in the database?
14. In Django how would you retrieve all the 'User' records from a given database?
15. A set of helpful applications to use within your Django projects is included in the official distribution. This module is called what?
16. What does the Django command `manage.py shell` do?
17. Where is pre_save signal in Django
18. What is Dijit?
19. What does the Django command `manage.py validate` do?
20. 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('', ______________________ )
21. What is the purpose of the STATIC_ROOT setting?
22. Given the Python data: mydata = [ [ 0, 'Fred' ], [ 1, 'Wilma' ] ] How do you access the data in a Django template?
23. Given a model named 'User' that contains a DateTime field named 'last_login', how do you query for users that have never logged in?
24. What is the Django command to view a database schema of an existing (or legacy) database?
25. Given a model named 'User' that contains a field named 'email', how do you perform a case-insensitive exact match for the email 'fred@aol.com'?
26. What command compile Django's translation files?
27. 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?
28. What is the Django command to retrieve the first 10 'User' records from your database sorted by name descending?
29. You can handle multiple Django forms with what keyword argument when creating forms?
30. What command do you use to alter the fields Django displays for a given model in the Django admin ListView?
31. In settings.py, when DEBUG is set to ________, Django will email unhandled exceptional conditions.
32. 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?
33. How do you create a recursive relationship in a model class named 'Company' in Django?
34. The Benevolent Dictators for Life of the Django Project are:
35. The django.contrib.contenttypes application provides
36. 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 %}
37. How to set a default order by in your Django model ? YourModel.objects.all() will be ordered by default without calling order_by() method
38. Given a model named 'User' that contains a CharField 'name', how do you query for users whose name starts with 'Fred' or 'Bob'?
39. How would you perform a lookup on a model against a database aside from the default?
40. Which model field type does NOT exist in Django?
41. What datetime formatting would you apply in a template to display the following: 2013/03/20 8:00:06 AM ?
42. What is the name of the Django decorator that hides sensitive info from error reports?
43. By using django.contrib.humanize, you can use the following filter in your template to display the number 3 as three.
44. What kind of relation is defined between models A and B by invoking ForeignKey(A) in the class definition for model B?
45. What is the table name for model named Choice in application question?
46. How do you inherit the A.html template in B.html template?
47. How can you access a variable in template which is passed from view? Suppose the variable name is object.
48. Which best practice is NOT relevant to migrations?
49. What is the result of this template code? {{"live long and prosper"|truncate:3}}
Django MCQs | Topic-wise