Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
5433ef99
Commit
5433ef99
authored
Sep 28, 2012
by
Sofia Papagiannaki
Browse files
Display resource limit details
parent
2d4be2bc
Changes
4
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/models.py
View file @
5433ef99
...
...
@@ -193,8 +193,7 @@ class AstakosGroup(Group):
@
property
def
quota
(
self
):
d
=
defaultdict
(
int
)
query
=
self
.
astakosgroupquota_set
.
select_related
().
all
()
for
q
in
query
:
for
q
in
self
.
astakosgroupquota_set
.
select_related
().
all
():
d
[
q
.
resource
]
+=
q
.
uplimit
return
d
...
...
@@ -297,9 +296,9 @@ class AstakosUser(User):
@
property
def
quota
(
self
):
d
=
defaultdict
(
int
)
for
q
in
self
.
astakosuserquota_set
.
all
():
for
q
in
self
.
astakosuserquota_set
.
select_related
().
all
():
d
[
q
.
resource
.
name
]
+=
q
.
uplimit
for
m
in
self
.
membership_set
.
all
():
for
m
in
self
.
membership_set
.
select_related
().
all
():
if
not
m
.
is_approved
:
continue
g
=
m
.
group
...
...
snf-astakos-app/astakos/im/templates/im/astakosuserquota_list.html
View file @
5433ef99
...
...
@@ -5,26 +5,39 @@
{% block page.body %}
<div
class=
"maincol {% block innerpage.class %}{% endblock %}"
>
<div
class=
"section"
>
{% if quota %}
<table
class=
"zebra-striped id-sorted"
>
<thead>
<tr>
<th>
Resource
</th>
<th>
Limit
</th>
</tr>
</thead>
<tbody>
{% for k in quota|dkeys %}
<tr>
<td>
{{ k }}
</td>
<td>
{{ quota|lookup:k }}
</td>
</tr>
{% for k, v in user.quota|items %}
<strong>
{{k}}
</strong>
<table
class=
"zebra-striped id-sorted"
>
<!--
<thead>
<tr>
<th>Limit (Group)</th>
</tr>
</thead>
-->
<tbody>
{% for m in user.membership_set.select_related.all %}
{% if m.group.is_enabled %}
{% with m.group.quota as quota %}
{% if quota %}
{% for kk, vv in quota|items %}
{% if k == kk %}
<tr>
<td>
{{ vv }} ({{m.group.name}})
</td>
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% endwith %}
{% endif %}
{% endfor %}
<tr>
<td><strong>
{{ v }}
</strong></td>
</tr>
<tr/>
</tbody>
</table>
{% endfor %}
</tbody>
</table>
{% else %}
<p>
No policies
</p>
{% endif %}
</div>
</div>
{% endblock %}
snf-astakos-app/astakos/im/templatetags/filters.py
View file @
5433ef99
...
...
@@ -34,6 +34,8 @@
import
calendar
import
datetime
from
collections
import
defaultdict
from
django
import
template
from
django.core.paginator
import
Paginator
,
EmptyPage
from
django.db.models.query
import
QuerySet
...
...
@@ -126,4 +128,10 @@ def paginate(l, args):
def
concat
(
str1
,
str2
):
if
not
str2
:
return
str
(
str1
)
return
'%s%s%s'
%
(
str1
,
DELIM
,
str2
)
\ No newline at end of file
return
'%s%s%s'
%
(
str1
,
DELIM
,
str2
)
@
register
.
filter
def
items
(
d
):
if
isinstance
(
d
,
defaultdict
):
return
d
.
iteritems
()
return
d
\ No newline at end of file
snf-astakos-app/astakos/im/views.py
View file @
5433ef99
...
...
@@ -1029,8 +1029,7 @@ def disapprove_member(request, membership):
def
resource_list
(
request
):
return
render_response
(
template
=
'im/astakosuserquota_list.html'
,
context_instance
=
get_context
(
request
),
quota
=
request
.
user
.
quota
)
context_instance
=
get_context
(
request
))
def
group_create_list
(
request
):
...
...
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