Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9f8a6c43
authored
Aug 05, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: host creation view
parent
a6b0b95c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
7 deletions
+44
-7
network/forms.py
+1
-4
network/templates/network/host-create.html
+21
-0
network/templates/network/host-list.html
+11
-1
network/urls.py
+3
-1
network/views.py
+8
-1
No files found.
network/forms.py
View file @
9f8a6c43
...
...
@@ -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'
),
...
...
network/templates/network/host-create.html
0 → 100644
View file @
9f8a6c43
{% 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 %}
network/templates/network/host-list.html
View file @
9f8a6c43
...
...
@@ -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 %}
network/urls.py
View file @
9f8a6c43
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
(),
...
...
network/views.py
View file @
9f8a6c43
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment