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
44798159
authored
Sep 11, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: filter records by type
parent
b0c97aa9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
circle/network/templates/network/record-list.html
+8
-0
circle/network/views.py
+13
-0
No files found.
circle/network/templates/network/record-list.html
View file @
44798159
...
@@ -15,6 +15,14 @@
...
@@ -15,6 +15,14 @@
</h1>
</h1>
</div>
</div>
<ul
class=
"nav nav-pills"
style=
"margin: 5px 0 20px 0;"
>
<li
class=
"disabled"
><a
href=
"#"
>
{% trans "Filter by type" %}
</a></li>
<li
{%
if
not
request
.
GET
.
type
%}
class=
"active"
{%
endif
%}
><a
href=
"{{ request.path }}"
>
{% trans "ALL" %}
</a></li>
{% for type in types %}
<li
{%
if
request
.
GET
.
type =
=
type
.
0
%}
class=
"active"
{%
endif
%}
><a
href=
"?type={{ type.0 }}"
>
{{ type.0 }}
</a></li>
{% endfor %}
</ul>
<div
class=
"table-responsive"
>
<div
class=
"table-responsive"
>
{% render_table table %}
{% render_table table %}
</div>
</div>
...
...
circle/network/views.py
View file @
44798159
...
@@ -420,6 +420,19 @@ class RecordList(SingleTableView):
...
@@ -420,6 +420,19 @@ class RecordList(SingleTableView):
template_name
=
"network/record-list.html"
template_name
=
"network/record-list.html"
table_pagination
=
False
table_pagination
=
False
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
RecordList
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'types'
]
=
Record
.
CHOICES_type
return
context
def
get_table_data
(
self
):
type_id
=
self
.
request
.
GET
.
get
(
'type'
)
if
type_id
:
data
=
Record
.
objects
.
filter
(
type
=
type_id
)
.
select_related
()
else
:
data
=
Record
.
objects
.
select_related
()
return
data
class
RecordDetail
(
UpdateView
,
SuccessMessageMixin
):
class
RecordDetail
(
UpdateView
,
SuccessMessageMixin
):
model
=
Record
model
=
Record
...
...
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