Everything is finally set to write our views. Open up views.py from the Arenas application folder within an IDE. Import the required libraries, models, forms, and modules:
from django.shortcuts import render, redirectfrom django.http import HttpResponse, HttpResponseNotFoundfrom .models import US_States, Counties, Districts, Arenasfrom .forms import ArenaFormfrom django.views.decorators.http import require_http_methodsimport random
Next, we will create two views—index and arena, and one non-view function called queryarena. These match with the URLs we added to urls.py. The return from the index function is very simple—it will redirect to the function arena. For the views, a decorator is used to determine the HTTP request methods ...