Skip to content

Commit

Permalink
close #81; giveback returns to customer or place
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-spitze committed Oct 13, 2022
1 parent ceb9050 commit a01766a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion django/project/inventory/templates/inventory/giveBack.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
<br />
<form method="post">{% csrf_token %}
<input class="button" type="submit" value="{% trans 'Save' %}" />
<a href="{% url 'inventory:detailWorkplace' user.id %}" class="button button-cancel">{% trans 'Cancel' %}</a>
<a href="{% if placeType == "customer" %}
{% url 'inventory:detailCustomer' place.id %}
{% else %}
{% url 'inventory:detailWorkplace' place.id %}
{% endif %}" class="button button-cancel">{% trans 'Cancel' %}</a>

</form>
{% endblock %}
7 changes: 6 additions & 1 deletion django/project/inventory/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,9 @@ def giveBack(request, handoverID):
return HttpResponseRedirect('/inventory/detailCustomer/' + str(place.id))
return HttpResponseRedirect('/inventory/detailWorkplace/' + str(place.id))

return render(request, 'inventory/giveBack.html', { 'place':place, 'thing':thing })
if oldHandover.user_content_type == ContentType.objects.get_for_model(Customer):
placeType = "customer"
else:
placeType = "workplace"

return render(request, 'inventory/giveBack.html', { 'place':place, 'thing':thing , 'placeType':placeType})

0 comments on commit a01766a

Please sign in to comment.