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