Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0debf36d
authored
Sep 09, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add record table to host detail
parent
5383465a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
2 deletions
+37
-2
circle/network/static/network/network.css
+5
-0
circle/network/tables.py
+19
-0
circle/network/templates/network/host-edit.html
+7
-2
circle/network/views.py
+6
-0
No files found.
circle/network/static/network/network.css
View file @
0debf36d
...
...
@@ -6,3 +6,8 @@
text-align
:
center
;
}
#host-detail-records-table
td
:first-child
,
#host-detail-records-table
th
:first-child
{
text-align
:
center
;
width
:
60px
;
}
circle/network/tables.py
View file @
0debf36d
...
...
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License along
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from
django.utils.translation
import
ugettext_lazy
as
_
from
django_tables2
import
Table
,
A
from
django_tables2.columns
import
LinkColumn
,
TemplateColumn
...
...
@@ -181,3 +183,20 @@ class VlanGroupTable(Table):
attrs
=
{
'class'
:
'table table-striped table-condensed'
}
fields
=
(
'name'
,
'vlans'
,
'description'
,
'owner'
,
)
order_by
=
'name'
class
HostRecordsTable
(
Table
):
fqdn
=
LinkColumn
(
"network.record"
,
args
=
[
A
(
"pk"
)],
order_by
=
(
"name"
,
),
)
class
Meta
:
model
=
Record
attrs
=
{
'class'
:
"table table-striped table-bordered"
,
'id'
:
"host-detail-records-table"
,
}
fields
=
(
"type"
,
"fqdn"
)
order_by
=
(
"name"
,
)
empty_text
=
_
(
"No records."
)
circle/network/templates/network/host-edit.html
View file @
0debf36d
...
...
@@ -45,7 +45,7 @@
{% endif %}
<div
class=
"page-header"
>
<h3>
Add host group
</h3>
<h3>
{% trans "Add host group" %}
</h3>
</div>
{% if not_used_groups|length == 0 %}
No more groups to add!
...
...
@@ -64,7 +64,12 @@
</div>
<!-- input-group -->
</form>
{% endif %}
</div>
<!-- col-sm-4 -->
<div
class=
"page-header"
>
<h3>
{% trans "Records" %}
</h3>
</div>
{% render_table records_table %}
</div>
<!-- col-sm-5 -->
</div>
<!-- row -->
{% endblock %}
...
...
circle/network/views.py
View file @
0debf36d
...
...
@@ -399,6 +399,12 @@ class HostDetail(LoginRequiredMixin, SuperuserRequiredMixin,
# set host pk (we need this for URL-s)
context
[
'host_pk'
]
=
self
.
kwargs
[
'pk'
]
from
network.tables
import
HostRecordsTable
context
[
'records_table'
]
=
HostRecordsTable
(
Record
.
objects
.
filter
(
host
=
self
.
get_object
()),
request
=
self
.
request
)
return
context
def
get_success_url
(
self
):
...
...
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