Add Project Files
This commit is contained in:
23
hosts/views.py
Normal file
23
hosts/views.py
Normal file
@@ -0,0 +1,23 @@
|
||||
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'
|
||||
Reference in New Issue
Block a user