if not modifying pledge use ack data from previous transaction to prefill ack boxes [#37939351]
parent
79fca69cf9
commit
96918d60a5
|
@ -8,6 +8,7 @@
|
|||
<link type="text/css" rel="stylesheet" href="/static/css/pledge.css" />
|
||||
|
||||
<script type="text/javascript" src="/static/js/reconcile_pledge.js"></script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block news %}
|
||||
|
@ -128,11 +129,15 @@
|
|||
{% if transaction.ack_name %}
|
||||
<div id="pass_ack_name" style="display: none;">{{ transaction.ack_name }}</div>
|
||||
{% else %}
|
||||
<div id="pass_ack_name" style="display: none;">{{ request.user.username }}</div>
|
||||
<div id="pass_ack_name" style="display: none;">{{ ack_name }}</div>
|
||||
{% endif %}
|
||||
<div id="pass_ack_link" style="display: none;">{{ transaction.ack_link }}</div>
|
||||
<div id="pass_ack_dedication" style="display: none;">{{ transaction.ack_dedication }}</div>
|
||||
{% if transaction.anonymous %}
|
||||
<div id="pass_anon" style="display: none;">{{ transaction.anonymous }}</div>
|
||||
{% else %}
|
||||
<div id="pass_anon" style="display: none;">{{ anonymous }}</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
|
|
@ -676,6 +676,19 @@ class PledgeView(FormView):
|
|||
context = super(PledgeView, self).get_context_data(**kwargs)
|
||||
context['nonprofit'] = settings.NONPROFIT
|
||||
|
||||
# use preferences from last transaction, if any
|
||||
try:
|
||||
last_transaction = Transaction.objects.filter(user=self.request.user).order_by('-date_modified')[0]
|
||||
except:
|
||||
last_transaction = None
|
||||
|
||||
if last_transaction:
|
||||
ack_name=last_transaction.ack_name
|
||||
anonymous=last_transaction.anonymous
|
||||
else:
|
||||
ack_name=self.request.user.username
|
||||
anonymous=''
|
||||
|
||||
context.update({
|
||||
'work':self.work,
|
||||
'campaign':self.campaign,
|
||||
|
@ -684,6 +697,8 @@ class PledgeView(FormView):
|
|||
'faqmenu': 'modify' if self.transaction else 'pledge',
|
||||
'transaction': self.transaction,
|
||||
'tid': self.transaction.id if self.transaction else None,
|
||||
'ack_name':ack_name,
|
||||
'anonymous':anonymous,
|
||||
})
|
||||
|
||||
return context
|
||||
|
|
Loading…
Reference in New Issue