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, redirect
from django.http import HttpResponse, HttpResponseNotFound
from .models import US_States, Counties, Districts, Arenas
from .forms import ArenaForm
from django.views.decorators.http import require_http_methods
import 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 allowed.