Commit 9f8a6c43 by Kálmán Viktor

network: host creation view

parent a6b0b95c
...@@ -141,10 +141,7 @@ class HostForm(ModelForm): ...@@ -141,10 +141,7 @@ class HostForm(ModelForm):
# 'modified_at', # 'modified_at',
# 'id' # 'id'
), ),
css_class='span8'), css_class='span12'),
Div(
HTML('<p>hello</p>'),
css_class='span4'),
), ),
ButtonHolder( ButtonHolder(
Submit('submit', 'Save'), Submit('submit', 'Save'),
......
{% extends "network/base.html" %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% load crispy_forms_tags %}
{% block content %}
<div class="page-heading">
<h2>Create a new host</h2>
</div>
<div class="row">
<div class="span8">
{% crispy form %}
</div>
<div class="span4">
</div><!-- span4 -->
</div><!-- row -->
{% endblock %}
...@@ -5,8 +5,17 @@ ...@@ -5,8 +5,17 @@
{% load staticfiles %} {% load staticfiles %}
{% block content %} {% block content %}
<style>
</style>
<div class="page-heading"> <div class="page-heading">
<h1>Hosts <small>list of all hosts</small></h1> <h1>
Hosts
<small>
list of all hosts
<a href="{% url network.host_create %}"><i class="icon-plus"></i></a>
</small>
</h1>
</div> </div>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
...@@ -18,4 +27,5 @@ ...@@ -18,4 +27,5 @@
</ul> </ul>
{% render_table table %} {% render_table table %}
{% endblock %} {% endblock %}
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from .views import (IndexView, HostList, HostDetail, VlanList, VlanDetail, from .views import (IndexView, HostList, HostDetail, HostCreate, VlanList,
VlanDetail,
DomainList, DomainDetail, GroupList, GroupDetail, DomainList, DomainDetail, GroupList, GroupDetail,
RecordList, RecordDetail, BlacklistList, BlacklistDetail, RecordList, RecordDetail, BlacklistList, BlacklistDetail,
RuleList, RuleDetail, VlanGroupList, VlanGroupDetail, RuleList, RuleDetail, VlanGroupList, VlanGroupDetail,
...@@ -20,6 +21,7 @@ urlpatterns = patterns( ...@@ -20,6 +21,7 @@ urlpatterns = patterns(
url('^groups/$', GroupList.as_view(), name='network.group_list'), url('^groups/$', GroupList.as_view(), name='network.group_list'),
url('^groups/(?P<pk>\d+)/$', GroupDetail.as_view(), name='network.group'), url('^groups/(?P<pk>\d+)/$', GroupDetail.as_view(), name='network.group'),
url('^hosts/$', HostList.as_view(), name='network.host_list'), url('^hosts/$', HostList.as_view(), name='network.host_list'),
url('^hosts/create$', HostCreate.as_view(), name='network.host_create'),
url('^hosts/(?P<pk>\d+)/$', HostDetail.as_view(), name='network.host'), url('^hosts/(?P<pk>\d+)/$', HostDetail.as_view(), name='network.host'),
url('^records/$', RecordList.as_view(), name='network.record_list'), url('^records/$', RecordList.as_view(), name='network.record_list'),
url('^records/(?P<pk>\d+)/$', RecordDetail.as_view(), url('^records/(?P<pk>\d+)/$', RecordDetail.as_view(),
......
from django.views.generic import TemplateView, UpdateView, DeleteView from django.views.generic import (TemplateView, UpdateView, DeleteView,
CreateView)
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
...@@ -157,6 +158,12 @@ class HostDetail(UpdateView): ...@@ -157,6 +158,12 @@ class HostDetail(UpdateView):
return reverse_lazy('network.host', kwargs=self.kwargs) return reverse_lazy('network.host', kwargs=self.kwargs)
class HostCreate(CreateView):
model = Host
template_name = "network/host-create.html"
form_class = HostForm
class RecordList(SingleTableView): class RecordList(SingleTableView):
model = Record model = Record
table_class = RecordTable table_class = RecordTable
......
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