Sessions are __________.
All
urlpatterns should be a python list of ______ instances.both
By default, Django serializes session using ________.json
A custom path converter is a class that includes _______.All
Identify the equivalent of the following code.urlpatterns = [ path('blog/', include(sitepatterns), {'blog_id':
6}),]
sitepatterns = [
path('archive/', views.archive, {'blog_id': 6}),
path('about/', views.about, {'blog_id': 6}),
Which is a valid path converter?All
Identify the incorrect path argument.model
Identify the incorrect middleware hook.template_view()
There are many error views by default in Django. Identify the incorrect one.http_forbidden()
HttpRequest object is automatically created by Django when a page is refreshed.T
Mixins are a form of multiple inheritance where behaviors and attributes of multiple parent classes can
be combined.T
Generic views ____________.All
Which view can be used to show the detail of an object?DetailView
Which shortcut function returns the result of filter() on a given model manager cast to a list, raising
Http404 if the resulting list is empty get_list_or_404()
Which view decorator module can be used to restrict access to views based on the request method?
django.views.decorators.http
Which view decorator module can be used to control server and client-side caching?
django.views.decorators.cache
Identify the incorrect option. when ALLOWED_HOSTS configuration is empty, host is validated against
______.[1::]
With {% load humanize %} and the filter intword is used, the value for 3860000 becomes?3.86 million
Which view decorator module can be used to control content compression on a per-view basis?
django.views.decorators.http
Which setting parameter should be modified to start django server with ip 127.100.10.1?
ALLOWED_HOSTS
Strings that have been marked safe from further escaping at output time are called __________.Safe
Strings
What is the output of the following code?
>>> from django.template import Context
>>> c = Context({"car": "Toyota"})
>>> c['car']KeyError
Which is not a Generic Editing View?DetailView
Adding a middleware component to the MIDDLEWARE list in the Django settings, activates the
middleware. T
If you write customized error views, the permission_denied() view should be overridden by which
handler?handler404
Which response object allows decorators or middleware to modify a response after it has been
constructed by the view?TemplateResponse
When you define custom tags and filters using python to make them available to templates, use
__________.{% load %}
Identify the incorrect Base View.BaseView
Which HttpResponse can be used to send a JSON encoded response?JsonResponse objects
When {% extends %} is used for inheriting a template?It should be the first template tag in the template
Which filter is available if {% load humanize %} is used in template?All
Which option does Django templates accept?All
Which template configuration defines a list of directories where the engine should look for template
source files, in search order?DIRS.
When a template system encounters a dot, it tries _______.All
You cannot have spaces or punctuation characters in variable names.T
filesizeformat filter in a template, provides the output in a human readable format.T
Since the template language doesn’t provide exception handling, any exception raised from a template
filter will be exposed as a server error.T
Consider the following code where f is a Form object.
>>> f = ContactForm()
>>> print(f)
What is the output?The form renders as HTML
A Form instance is either bound to a set of data or unbound.T
The clean() method on a Field subclass is responsible for running All
What is the output of the following code?
>>> from django import forms
>>> f = forms.CharField()
>>> f.clean('') Validation Error
A ______ is a layer of abstraction to work with multiple forms on the same page.Formset
To declare the initial value of form fields at runtime, use ________.Form.initial
Identify the invalid form field attributes. {{ field.invalid }}
To render the form as a series of <li> tags, use_______. Form.as_ul()