Test your knowledge
Let's see whether you can answer the following questions correctly:
- The
urlpatternslist declared in theurls.pyfile makes it possible to:- Route URLs to Django models
- Route URLs to Django views
- Route URLs to Python primitives
- When the Django server receives an HTTP request, Django creates an instance of which of the following classes?
django.restframework.HttpRequestdjango.http.HttpRequestdjango.http.Request
- A view function has to return an instance of which of the following classes?
django.http.HttpResponsedjango.http.Responsedjango.restfremework.HttpResponse
- Whenever you have to return a specific status different from the default
200 OKstatus, it is a good practice to use the module variables defined in which of the following modules?rest_framework.HttpStatusdjango.statusrest_framework.status
- If you want to retrieve a Toy instance whose primary key value is equal to
10and save it in the toy variable, which line of code would you write?- toy = Toy.get_by(pk=10)
- toy = Toy...