To add a URL pattern with regex, you use the
re_path()
function instead of thepath()
function.True
False
Which of the following sentences about the
path()
function is correct? Select all that apply.The
path()
function is defined in thedjango.urls
module.The URL string parameter of the
path()
function captures query parameters from the URL.The
path()
function is used to define a URL pattern.The
path()
function returns the path of the Django app.
Complete the sentence. The path converters capture _____ from the URL.
Query parameters
URL parameters
Body parameters.
Path parameters
The
request.user
attribute contains the information of the current user.True
False
Complete the following sentence. The HTTP status code starting with 5 implies that:
The request has been received and is under process.
There is a client-side error.
The action has been successfully completed.
The server has encountered an error.
What are the important features of a class-based view? Select all that apply.
Class-based views are reusable.
A class-based view subclasses the
django.view
.View base class.The
as_view()
method maps a URL to a class-based view.A class-based view implements different methods for each HTTP method.
The
Http404
response is a convenient alternative for anHttpResponse
.True
False
Complete the following sentence. The URL name is _______________.
Select all that apply.
used by the
reverse()
function to fetch the URL mapped with the view function.an optional parameter passed inside the
path()
function.used to define URL namespace.
passed as the
name
parameter in thepath()
function.
Can you define views in the
views.py
file in the projects folder?Yes
No
Complete the following sentence. To override the default error view, _______________.
Select all that apply.
specify the appropriate handler in the project's URLConf.
define the custom view in the project folder.
you should define the custom error handler view in the app's
views.py
file.there's no need to override the default error views.