Commit 9f8a6c43 by Kálmán Viktor

network: host creation view

parent a6b0b95c
......@@ -141,10 +141,7 @@ class HostForm(ModelForm):
# 'modified_at',
# 'id'
),
css_class='span8'),
Div(
HTML('<p>hello</p>'),
css_class='span4'),
css_class='span12'),
),
ButtonHolder(
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 @@
{% load staticfiles %}
{% block content %}
<style>
</style>
<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>
<ul class="nav nav-pills">
......@@ -18,4 +27,5 @@
</ul>
{% render_table table %}
{% endblock %}
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,
RecordList, RecordDetail, BlacklistList, BlacklistDetail,
RuleList, RuleDetail, VlanGroupList, VlanGroupDetail,
......@@ -20,6 +21,7 @@ urlpatterns = patterns(
url('^groups/$', GroupList.as_view(), name='network.group_list'),
url('^groups/(?P<pk>\d+)/$', GroupDetail.as_view(), name='network.group'),
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('^records/$', RecordList.as_view(), name='network.record_list'),
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.shortcuts import render, redirect
......@@ -157,6 +158,12 @@ class HostDetail(UpdateView):
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):
model = Record
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