Browse Source

Add comment to payment

devel
bashmak 8 years ago
parent
commit
a564506f75
  1. 8
      abonapp/templates/abonapp/modal_abonamount.html
  2. 6
      abonapp/views.py

8
abonapp/templates/abonapp/modal_abonamount.html

@ -15,6 +15,14 @@
</div>
</div>
<input type="hidden" name="abonuname" value="{{ abon.username }}"><br>
<div class="form-group-sm">
<label for="comment">{% trans 'Comment' %}</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-pencil"></span></span>
<input id="comment" type="text" name="comment" class="form-control">
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-sm btn-primary">

6
abonapp/views.py

@ -3,6 +3,7 @@ from django.contrib.gis.shortcuts import render_to_text
from django.core.exceptions import PermissionDenied, ValidationError
from django.db import IntegrityError, ProgrammingError, transaction
from django.db.models import Count, Q
from django.http.request import QueryDict
from django.shortcuts import render, redirect, get_object_or_404, resolve_url
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseRedirect
@ -195,7 +196,10 @@ def abonamount(request, gid, uname):
abonuname = request.POST.get('abonuname')
if abonuname == uname:
amnt = lib.safe_float(request.POST.get('amount'))
abon.add_ballance(request.user, amnt, comment=_('fill account through admin side'))
comment = request.POST.get('comment')
if not comment:
comment = _('fill account through admin side')
abon.add_ballance(request.user, amnt, comment=comment)
abon.save(update_fields=('ballance',))
messages.success(request, _('Account filled successfully on %.2f') % amnt)
return redirect('abonapp:abon_phistory', gid=gid, uname=uname)

Loading…
Cancel
Save