Files
HighTower/hosts/views.py
2022-06-20 13:41:51 +03:00

24 lines
508 B
Python

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'