Now in campaign admin, you can pick specific campaign to take action on.
parent
217f06edeb
commit
c721c9c6b2
|
@ -30,19 +30,18 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Active transactions -->
|
<!-- Active transactions -->
|
||||||
|
|
||||||
<p style="font-weight:bold">Campaigns with active transactions</p>
|
<p style="font-weight:bold">Campaigns with active transactions</p>
|
||||||
{% if campaigns_with_active_transactions %}
|
{% if campaigns_with_active_transactions %}
|
||||||
|
<form method="post" action="#">
|
||||||
|
{% csrf_token %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for campaign in campaigns_with_active_transactions %}
|
{% for campaign in campaigns_with_active_transactions %}
|
||||||
<li>{{campaign.id}} | {{campaign.name}} </li>
|
<li><input type="radio" name="active_campaign" value="{{campaign.id}}" />{{campaign.id}} | {{campaign.name}} </li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
<form method="post" action="#">
|
|
||||||
{% csrf_token %}
|
|
||||||
<input type="submit" name="execute_campaigns" value="Execute Payment to Gluejar" id="submit">
|
<input type="submit" name="execute_campaigns" value="Execute Payment to Gluejar" id="submit">
|
||||||
</form>
|
|
||||||
<form method="post" action="#">
|
|
||||||
{% csrf_token %}
|
|
||||||
<input type="submit" name="cancel_campaigns" value="Cancel Active Transactions" id="submit">
|
<input type="submit" name="cancel_campaigns" value="Cancel Active Transactions" id="submit">
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -52,13 +51,13 @@
|
||||||
<!-- incomplete transactions -->
|
<!-- incomplete transactions -->
|
||||||
<p style="font-weight:bold">Campaigns with incomplete transactions</p>
|
<p style="font-weight:bold">Campaigns with incomplete transactions</p>
|
||||||
{% if campaigns_with_incomplete_transactions %}
|
{% if campaigns_with_incomplete_transactions %}
|
||||||
<ul>
|
|
||||||
{% for campaign in campaigns_with_incomplete_transactions %}
|
|
||||||
<li>{{campaign.id}} | {{campaign.name}} </li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
<form method="post" action="#">
|
<form method="post" action="#">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<ul>
|
||||||
|
{% for campaign in campaigns_with_incomplete_transactions %}
|
||||||
|
<li><input type="radio" name="incomplete_campaign" value="{{campaign.id}}" />{{campaign.id}} | {{campaign.name}} </li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
<input type="submit" name="finish_campaigns" value="Pay Rights Holders" id="submit">
|
<input type="submit" name="finish_campaigns" value="Pay Rights Holders" id="submit">
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -474,18 +474,33 @@ def campaign_admin(request):
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
check_status_results = e
|
check_status_results = e
|
||||||
elif 'execute_campaigns' in request.POST.keys():
|
elif 'execute_campaigns' in request.POST.keys():
|
||||||
campaigns_with_active_transactions = models.Campaign.objects.filter(transaction__status=IPN_PAY_STATUS_ACTIVE)
|
c_id = request.POST.get('active_campaign', None)
|
||||||
results = [pm.execute_campaign(c) for c in campaigns_with_active_transactions]
|
if c_id is not None:
|
||||||
command_status = str(results)
|
try:
|
||||||
|
campaign = models.Campaign.objects.get(id=c_id)
|
||||||
|
results = pm.execute_campaign(campaign)
|
||||||
|
command_status = str(results)
|
||||||
|
except Exception, e:
|
||||||
|
command_status = "Error in executing transactions for campaign %s " % (str(e))
|
||||||
elif 'finish_campaigns' in request.POST.keys():
|
elif 'finish_campaigns' in request.POST.keys():
|
||||||
campaigns_with_incomplete_transactions = models.Campaign.objects.filter(transaction__status=IPN_PAY_STATUS_INCOMPLETE)
|
c_id = request.POST.get('incomplete_campaign', None)
|
||||||
results = [pm.finish_campaign(c) for c in campaigns_with_incomplete_transactions]
|
if c_id is not None:
|
||||||
command_status = str(results)
|
try:
|
||||||
pass
|
campaign = models.Campaign.objects.get(id=c_id)
|
||||||
|
results = pm.finish_campaign(campaign)
|
||||||
|
command_status = str(results)
|
||||||
|
except Exception, e:
|
||||||
|
command_status = "Error in finishing transactions for campaign %s " % (str(e))
|
||||||
|
|
||||||
elif 'cancel_campaigns' in request.POST.keys():
|
elif 'cancel_campaigns' in request.POST.keys():
|
||||||
campaigns_with_active_transactions = models.Campaign.objects.filter(transaction__status=IPN_PAY_STATUS_ACTIVE)
|
c_id = request.POST.get('active_campaign', None)
|
||||||
results = [pm.cancel_campaign(c) for c in campaigns_with_active_transactions]
|
if c_id is not None:
|
||||||
command_status = str(results)
|
try:
|
||||||
|
campaign = models.Campaign.objects.get(id=c_id)
|
||||||
|
results = pm.cancel_campaign(campaign)
|
||||||
|
command_status = str(results)
|
||||||
|
except Exception, e:
|
||||||
|
command_status = "Error in canceling transactions for campaign %s " % (str(e))
|
||||||
|
|
||||||
(campaigns_with_active_transactions, campaigns_with_incomplete_transactions, campaigns_with_completed_transactions,
|
(campaigns_with_active_transactions, campaigns_with_incomplete_transactions, campaigns_with_completed_transactions,
|
||||||
campaigns_with_canceled_transactions) = campaigns_types()
|
campaigns_with_canceled_transactions) = campaigns_types()
|
||||||
|
|
Loading…
Reference in New Issue