from django.urls import reverse_lazy from django.views.generic import ListView, DetailView from django.views.generic.edit import CreateView from .models import Host class Index(ListView): model = Host template_name = 'index.html' paginate_by = 10 class HostCreate(CreateView): model = Host fields = ['host_name', 'port'] template_name = 'add_host.html' success_url = reverse_lazy('index') class HostDetail(DetailView): model = Host template_name = 'host_info.html'