Commit c50fc3e0 by Kálmán Viktor

network: fix host update

parent a017e6cf
...@@ -50,6 +50,7 @@ class HostForm(ModelForm): ...@@ -50,6 +50,7 @@ class HostForm(ModelForm):
'description', 'description',
'location', 'location',
'comment', 'comment',
'owner',
# 'created_at', # 'created_at',
# 'modified_at', # 'modified_at',
# 'id' # 'id'
......
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.views.generic import UpdateView from django.views.generic import UpdateView
from django.core.urlresolvers import reverse_lazy
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
...@@ -23,6 +24,10 @@ class HostDetail(UpdateView): ...@@ -23,6 +24,10 @@ class HostDetail(UpdateView):
template_name = "network/host-edit.html" template_name = "network/host-edit.html"
form_class = HostForm form_class = HostForm
def get_success_url(self):
if 'pk' in self.kwargs:
return reverse_lazy('network.host', kwargs=self.kwargs)
class VlanList(SingleTableView): class VlanList(SingleTableView):
model = Vlan model = Vlan
...@@ -40,3 +45,5 @@ class VlanDetail(UpdateView): ...@@ -40,3 +45,5 @@ class VlanDetail(UpdateView):
q = Host.objects.filter(vlan=self.object).all() q = Host.objects.filter(vlan=self.object).all()
context['host_list'] = SmallHostTable(q) context['host_list'] = SmallHostTable(q)
return context return context
success_url = reverse_lazy('network.vlan_list')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment