Complete the code to import the decorator that allows only GET requests.
from django.views.decorators.http import [1]
The require_GET decorator restricts a view to only handle GET requests.
Complete the code to decorate the view so it only accepts POST requests.
@[1] def submit_form(request): return HttpResponse('Form submitted')
The require_POST decorator ensures the view only accepts POST requests.
Fix the error in the code by completing the decorator import correctly.
from django.views.decorators.http import [1] @require_GET def show_data(request): return HttpResponse('Data shown')
The correct decorator name is require_GET with uppercase GET.
Fill both blanks to create a view that only accepts GET requests and returns a simple response.
from django.http import HttpResponse from django.views.decorators.http import [1] @[2] def home(request): return HttpResponse('Welcome!')
Import and use require_GET decorator to restrict the view to GET requests.
Fill all three blanks to create a POST-only view that returns a confirmation message.
from django.http import HttpResponse from django.views.decorators.http import [1] @[2] def submit(request): if request.method == '[3]': return HttpResponse('Submitted successfully')
Use require_POST decorator and check for 'POST' method string to restrict the view properly.