Commit c93e0444 authored by Olga Brani's avatar Olga Brani
Browse files

Fix update resources bug

parent b34d5588
......@@ -964,7 +964,8 @@ class ProjectApplicationForm(forms.ModelForm):
if uplimit:
append(dict(service=s, resource=r, uplimit=uplimit))
else:
append(dict(service=s, resource=r, uplimit=None))
append(dict(service=s, resource=r, uplimit=None))
return policies
......
......@@ -1399,6 +1399,11 @@ class ProjectApplication(models.Model):
resource = Resource.objects.get(service__name=service, name=resource)
q.create(resource=resource, member_capacity=uplimit)
@property
def grants(self):
return self.projectresourcegrant_set.values('member_capacity', 'resource__name', 'resource__service__name')
@property
def resource_policies(self):
return self.projectresourcegrant_set.all()
......
{% extends "im/account_base.html" %}
{% load filters %}
{% load astakos_tags %}
{% block headjs %}
{{ block.super }}
<script src="{{ IM_STATIC_URL }}js/quotas.js"></script>
......@@ -8,7 +9,8 @@
{% block page.body %}
{% with resource_catalog|populated_resource_catalog as resource_catalog%}
{% with resource_catalog|populated_resource_catalog as resource_catalog %}
{% if show_form %}
<form action="?verify=1#top" method="post" class="withlabels quotas-form" id="group_create_form">{% csrf_token %}
......@@ -94,6 +96,8 @@
{% with rname|add:'_uplimit' as input_value %}
value = "{{ request.POST|lookup:input_value }}"
{% endwith %}
{% else %}
value = "{% get_grant_value rname form %}"
{% endif %}
/>
<span class="extra-img">&nbsp;</span>
......
......@@ -68,4 +68,14 @@ class MessagesNode(template.Node):
@register.simple_tag
def olga(v):
return v+'a'
\ No newline at end of file
return v+'a'
@register.simple_tag
def get_grant_value(rname, form):
grants = form.instance.grants
service_name, resource_name = rname.split('.',1)
try:
return form.instance.projectresourcegrant_set.get(resource__name=resource_name,
resource__service__name=service_name).member_capacity
except:
return ''
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment