Resource request fixes
This commit is contained in:
parent
68e5c31426
commit
648be3ef83
|
@ -14,7 +14,7 @@ from .forms import RequestForm, ResponseForm, ProviderResponseForm
|
||||||
@login_required
|
@login_required
|
||||||
def listRequests(request):
|
def listRequests(request):
|
||||||
mnts = request.user.maintainer_set.all()
|
mnts = request.user.maintainer_set.all()
|
||||||
requestedFromMe = Request.objects.filter(applicant=mnts)
|
requestedFromMe = Request.objects.filter(applicant__in=mnts)
|
||||||
requestedToMe = Request.objects.filter(provider__in=mnts)
|
requestedToMe = Request.objects.filter(provider__in=mnts)
|
||||||
requests = (requestedFromMe | requestedToMe).order_by("-lastAction")
|
requests = (requestedFromMe | requestedToMe).order_by("-lastAction")
|
||||||
|
|
||||||
|
@ -60,9 +60,11 @@ def rrequestDetail(request, pk):
|
||||||
mnts = request.user.maintainer_set.all()
|
mnts = request.user.maintainer_set.all()
|
||||||
formClass = None
|
formClass = None
|
||||||
provider = None
|
provider = None
|
||||||
|
initialFormData = {}
|
||||||
if reqObj.provider in mnts:
|
if reqObj.provider in mnts:
|
||||||
provider = True
|
provider = True
|
||||||
formClass = ProviderResponseForm
|
formClass = ProviderResponseForm
|
||||||
|
initialFormData["createdResources"] = reqObj.grantedResources
|
||||||
else:
|
else:
|
||||||
provider = False
|
provider = False
|
||||||
formClass = ResponseForm
|
formClass = ResponseForm
|
||||||
|
@ -92,7 +94,7 @@ def rrequestDetail(request, pk):
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse("rrequests:show", args=(pk,)))
|
return HttpResponseRedirect(reverse("rrequests:show", args=(pk,)))
|
||||||
else:
|
else:
|
||||||
form = formClass(request=reqObj, user=request.user)
|
form = formClass(request=reqObj, user=request.user, initial=initialFormData)
|
||||||
|
|
||||||
return render(request, "rrequests/request_detail.html", {"request": reqObj, "form": form})
|
return render(request, "rrequests/request_detail.html", {"request": reqObj, "form": form})
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if request.grantedResources %}
|
||||||
|
<div role="alert" class="alert alert-info">
|
||||||
|
<span class="glyphicon glyphicon-ok"></span> Created resources: {{ request.grantedResources }}.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
<h4>Add / change</h4>
|
<h4>Add / change</h4>
|
||||||
<form method="post" action="#">
|
<form method="post" action="#">
|
||||||
|
|
Loading…
Reference in New Issue