Putting in stub for campaign_admin.
Let admin do a PaymentManger.checkStatus() to get the latest information about Transactions (using the PayPal PaymentDetails and PreapprovalDetails API methods)pull/1/head
parent
12a3f7f72f
commit
4e36892910
|
@ -189,3 +189,6 @@ class GoodreadsShelfLoadingForm(forms.Form):
|
|||
|
||||
class LibraryThingForm(forms.Form):
|
||||
lt_username = forms.CharField(max_length=30, required=True)
|
||||
|
||||
class CampaignAdminForm(forms.Form):
|
||||
pass
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
{% extends "basedocumentation.html" %}
|
||||
{% block base_js %}{% endblock %}
|
||||
{% block extra_extra_head %}
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen">
|
||||
{{ form.media.css }}
|
||||
<script type="text/javascript" src="/static/js/jquery-1.6.3.min.js"></script>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
|
||||
{{ form.media.js }}
|
||||
{% endblock %}
|
||||
|
||||
{% block doccontent %}
|
||||
|
||||
<h2>Campaign Admin</h2>
|
||||
|
||||
<form method="post" action="#">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" name="campaign_checkstatus" value="Update Transaction Statuses" id="submit">
|
||||
</form>
|
||||
|
||||
{% if check_status_results %}
|
||||
<p>Campaign checkstatus output:</p>
|
||||
|
||||
<textarea id="id" cols="45" rows="15">
|
||||
{% autoescape on %}
|
||||
{{check_status_results}}
|
||||
{% endautoescape %}
|
||||
</textarea>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
|
@ -22,6 +22,7 @@ urlpatterns = patterns(
|
|||
url(r"^rightsholders/campaign/(?P<id>\d+)/$", "manage_campaign", name="manage_campaign"),
|
||||
url(r"^rightsholders/claim/$", "claim", name="claim"),
|
||||
url(r"^rh_admin/$", "rh_admin", name="rh_admin"),
|
||||
url(r"^campaign_admin/$", "campaign_admin", name="campaign_admin"),
|
||||
url(r"^faq/$", TemplateView.as_view(template_name="faq.html"),
|
||||
name="faq"),
|
||||
url(r"^wishlist/$", "wishlist", name="wishlist"),
|
||||
|
|
|
@ -36,7 +36,7 @@ from regluit.core.search import gluejar_search
|
|||
from regluit.core.goodreads import GoodreadsClient
|
||||
from regluit.frontend.forms import UserData, ProfileForm, CampaignPledgeForm, GoodreadsShelfLoadingForm
|
||||
from regluit.frontend.forms import RightsHolderForm, UserClaimForm, LibraryThingForm, OpenCampaignForm
|
||||
from regluit.frontend.forms import ManageCampaignForm, DonateForm
|
||||
from regluit.frontend.forms import ManageCampaignForm, DonateForm, CampaignAdminForm
|
||||
from regluit.payment.manager import PaymentManager
|
||||
from regluit.payment.parameters import TARGET_TYPE_CAMPAIGN, TARGET_TYPE_DONATION
|
||||
from regluit.core import goodreads
|
||||
|
@ -413,6 +413,34 @@ def rh_admin(request):
|
|||
}
|
||||
return render(request, "rights_holders.html", context)
|
||||
|
||||
def campaign_admin(request):
|
||||
if not request.user.is_authenticated() :
|
||||
return render(request, "admins_only.html")
|
||||
if not request.user.is_staff :
|
||||
return render(request, "admins_only.html")
|
||||
|
||||
context = {}
|
||||
|
||||
# first task: run PaymentManager.checkStatus() to update Campaign statuses
|
||||
# does it return data to display?
|
||||
|
||||
form = CampaignAdminForm()
|
||||
|
||||
if request.method == 'GET':
|
||||
check_status_results = None
|
||||
elif request.method == 'POST':
|
||||
try:
|
||||
pm = PaymentManager()
|
||||
check_status_results = pm.checkStatus()
|
||||
except Exception, e:
|
||||
check_status_results = e
|
||||
|
||||
context.update({
|
||||
'form': form,
|
||||
'check_status_results':check_status_results
|
||||
})
|
||||
|
||||
return render(request, "campaign_admin.html", context)
|
||||
|
||||
def supporter(request, supporter_username, template_name):
|
||||
supporter = get_object_or_404(User, username=supporter_username)
|
||||
|
|
Loading…
Reference in New Issue