mirror of
https://github.com/Crocmagnon/charasheet.git
synced 2024-11-05 06:13:55 +01:00
Update responses
This commit is contained in:
parent
0a4f0503c0
commit
1f77eb98e1
1 changed files with 3 additions and 3 deletions
|
@ -26,7 +26,7 @@ def character_health_change(request: WSGIRequest, pk: int) -> HttpResponse:
|
|||
value = get_updated_value(request, character.health_remaining, character.health_max)
|
||||
character.health_remaining = value
|
||||
character.save(update_fields=["health_remaining"])
|
||||
return HttpResponse(character.health_remaining)
|
||||
return HttpResponse(value)
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -37,7 +37,7 @@ def character_mana_change(request: WSGIRequest, pk: int) -> HttpResponse:
|
|||
value = get_updated_value(request, character.mana_remaining, character.mana_max)
|
||||
character.mana_remaining = value
|
||||
character.save(update_fields=["mana_remaining"])
|
||||
return HttpResponse(character.mana_remaining)
|
||||
return HttpResponse(value)
|
||||
|
||||
|
||||
def get_updated_value(
|
||||
|
@ -72,5 +72,5 @@ def update_text_field(request, pk, field):
|
|||
if request.method == "GET":
|
||||
return render(request, f"character/{field}_update.html", context)
|
||||
setattr(character, field, request.POST.get(field))
|
||||
character.save()
|
||||
character.save(update_fields=[field])
|
||||
return render(request, f"character/{field}_display.html", context)
|
||||
|
|
Loading…
Reference in a new issue