Django Quiz
py manage.py createsuperuser
Django comes with a built-in user interface that allows you to administrate your data. To access this interface you have to create a user name and password. What is a correct syntax to create such user?
settings.py
Django comes with a file containing all the configuration of your Django installation, what is the file's name?
Yes
Django templates are often .html pages.
admin.py
For a model to be visible in the admin interface it has to be registered in which file?
from members.models import Member
If you have a Django application named members, and a model named Member, what is a correct syntax to import the model?
Python Functions
In Django, Views are written as:
Models
In Django, data is created in objects, what are these objects called in Django?
urls.py
In Django, incomming request is handled in which file?
views
In Django, incomming requests are redirected to specific functions, what are these functions called?
DEBUG = False
In the configuration file, what the correct syntax to turn off debugging?
filter(firstname='Emil')
QuerySets can be used to query data in Django. What is a correct syntax to get data where 'firstname' is 'Emil'?
{% for x in y %}
To perform programming logic in Django templates, you can use 'template tags', what is a correct syntax to start a for loop?
{{ firstname }}
To use a Django variable named firstname in a Django template, use this syntax:
django-admin startproject my_tennis_club
What is a correct syntax for creating a Django project?
py manage.py runserver
What is a correct syntax to start a Django development server on your computer?
comment
What is the correct Django tag to use when writing a comment?
if
What is the correct Django tag to use when writing a conditional (if) statement?
if A == B
What is the correct operator to use in if statements to evaulate if A is equal to B?
order_by('firstname')
What is the correct syntax to sort the queryset alphabetically by 'firstname'?
endif
What is the correct tag to use when ending an if statement?
with
What tag can be used to create a variable inside a template?
True
When debugging is turned off, you have to define which hosts are allowed to serve your project.
templates.py
When you create a Django project on your computer, you will get a folder for your project with a specific content. Which one of the following files is NOT part of the content?
py manage.py makemigrations
When you have done changes in a model, which command has to be executed in order to make the changes take effect in the database?
Python
Which language is Django written in?