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
4736dc22
authored
Apr 22, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix in GroupList
parent
e856cd60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
circle/dashboard/views.py
+29
-2
No files found.
circle/dashboard/views.py
View file @
4736dc22
...
...
@@ -955,12 +955,39 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
number_of_VMs
=
Count
(
'instance_set'
))
.
select_related
(
'host'
)
class
GroupList
(
LoginRequiredMixin
,
S
uperuserRequiredMixin
,
S
ingleTableView
):
class
GroupList
(
LoginRequiredMixin
,
SingleTableView
):
template_name
=
"dashboard/group-list.html"
mod
e
l
=
Group
mod
u
l
=
Group
table_class
=
GroupListTable
table_pagination
=
False
def
get
(
self
,
*
args
,
**
kwargs
):
if
self
.
request
.
is_ajax
():
pks
=
[
i
[
0
]
for
i
in
GroupProfile
.
get_objects_with_level
(
'operator'
,
self
.
request
.
user
)
.
values_list
(
'pk'
)]
groups
=
Group
.
objects
.
filter
(
groupprofile__in
=
pks
)
groups
=
[{
'url'
:
reverse
(
"dashboard.views.group-detail"
,
kwargs
=
{
'pk'
:
i
.
pk
}),
'name'
:
i
.
name
}
for
i
in
groups
]
return
HttpResponse
(
json
.
dumps
(
list
(
groups
)),
content_type
=
"application/json"
,
)
else
:
return
super
(
GroupList
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
logger
.
debug
(
'GroupList.get_queryset() called. User:
%
s'
,
unicode
(
self
.
request
.
user
))
pks
=
[
i
[
0
]
for
i
in
GroupProfile
.
get_objects_with_level
(
'operator'
,
self
.
request
.
user
)
.
values_list
(
'pk'
)]
groups
=
Group
.
objects
.
filter
(
groupprofile__in
=
pks
)
s
=
self
.
request
.
GET
.
get
(
"s"
)
if
s
:
groups
=
groups
.
filter
(
name__icontains
=
s
)
return
groups
class
GroupRemoveUserView
(
CheckedDetailView
,
DeleteView
):
model
=
Group
...
...
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