Fix UPS host form with custom form class for date handling
This commit is contained in:
@@ -3,7 +3,7 @@ from django.views.generic import ListView, CreateView, UpdateView, DeleteView
|
||||
from django.urls import reverse_lazy
|
||||
from django.contrib import messages
|
||||
from .models import UPSHost, Battery, Contact, Supplier, MaintenanceRecord
|
||||
from .forms import BatteryFormSet
|
||||
from .forms import BatteryFormSet, UPSHostForm
|
||||
|
||||
|
||||
class DashboardView(ListView):
|
||||
@@ -99,14 +99,14 @@ class UPSHostListView(ListView):
|
||||
class UPSHostCreateView(CreateView):
|
||||
model = UPSHost
|
||||
template_name = 'ups_manager/ups_form.html'
|
||||
fields = ['brand', 'model', 'ip_address', 'quantity', 'location', 'last_maintenance_date', 'contact']
|
||||
form_class = UPSHostForm
|
||||
success_url = reverse_lazy('ups_list')
|
||||
|
||||
|
||||
class UPSHostUpdateView(UpdateView):
|
||||
model = UPSHost
|
||||
template_name = 'ups_manager/ups_form.html'
|
||||
fields = ['brand', 'model', 'ip_address', 'quantity', 'location', 'last_maintenance_date', 'contact']
|
||||
form_class = UPSHostForm
|
||||
success_url = reverse_lazy('ups_list')
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user