set up acks page to deal with ack_name, _link, _dedication and anonymity bit
parent
b2161d8936
commit
8db1e5b59a
|
@ -368,6 +368,38 @@ class Campaign(models.Model):
|
|||
|
||||
return ungluers
|
||||
|
||||
def ungluer_transactions(self):
|
||||
"""
|
||||
returns a list of authorized transactions for campaigns in progress,
|
||||
or completed transactions for successful campaigns
|
||||
used to build the acks page -- because ack_name, _link, _dedication adhere to transactions,
|
||||
it's easier to return transactions than ungluers
|
||||
"""
|
||||
p = PaymentManager()
|
||||
ungluers={"all":[],"supporters":[], "patrons":[], "bibliophiles":[]}
|
||||
anons = 0
|
||||
if self.status == "ACTIVE":
|
||||
translist = p.query_campaign(self, summary=False, pledged=True, authorized=True)
|
||||
elif self.status == "SUCCESSFUL":
|
||||
translist = p.query_campaign(self, summary=False, pledged=True, completed=True)
|
||||
else:
|
||||
translist = []
|
||||
for transaction in translist:
|
||||
ungluers['all'].append(transaction.user)
|
||||
if not transaction.anonymous:
|
||||
if transaction.amount >= Premium.TIERS["bibliophile"]:
|
||||
ungluers['bibliophiles'].append(transaction)
|
||||
elif transaction.amount >= Premium.TIERS["patron"]:
|
||||
ungluers['patrons'].append(transaction)
|
||||
elif transaction.amount >= Premium.TIERS["supporter"]:
|
||||
ungluers['supporters'].append(transaction)
|
||||
else:
|
||||
anons += 1
|
||||
|
||||
ungluers['anons'] = anons
|
||||
|
||||
return ungluers
|
||||
|
||||
def effective_premiums(self):
|
||||
"""returns the available premiums for the Campaign including any default premiums"""
|
||||
q = Q(campaign=self) | Q(campaign__isnull=True)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "basedocumentation.html" %}
|
||||
{% block title %}Open Access eBooks{% endblock %}
|
||||
{% block title %}Ungluers supporting the {{ campaign }}{% endblock %}
|
||||
{% block extra_extra_head %}
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/vanilla.css" class="day" title="day" />
|
||||
{% endblock %}
|
||||
|
@ -9,41 +9,46 @@
|
|||
<div class="agate-info">
|
||||
<p>© {{ campaign.work.preferred_edition.publication_date }} by {{ campaign.work.author }}</p>
|
||||
<p>ISBN: {{ campaign.work.preferred_edition.isbn_13 }} .</p>
|
||||
<p>URI: <a href="https://unglue.it/{{ campaign.work.id }}/">https://unglue.it/work/{{ campaign.work.id }}/</a> (this work).</p>
|
||||
<p>URI: <a href="https://unglue.it/work/{{ campaign.work.id }}/">https://unglue.it/work/{{ campaign.work.id }}/</a> (this work).</p>
|
||||
<p><img src="images/unglueitlogo.png" alt="unglue.it logo" /></p>
|
||||
<p>
|
||||
This <i>unglued</i> edition is distributed under the terms of the Creative Commons (<a href="{{ campaign.license_url }}">{{ campaign.license }}</a>) license.
|
||||
The Creative Commons licensing is made possible by the support of readers like you.
|
||||
Become an ungluer at <a href="https://unglue.it/">https://unglue.it/</a>
|
||||
Become an ungluer at <a href="https://unglue.it/">https://unglue.it/</a> .
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
<section epub:type="other-credits" id="other-credits">
|
||||
<h2>This is an unglued ebook</h2>
|
||||
{% with campaign.ungluer_transactions as transactions %}
|
||||
<p>
|
||||
Unglued ebooks are made possible through the Unglue.it website by contributions from {{ campaign.ungluers.all|length }} readers like you.</p>
|
||||
{% if campaign.ungluers.supporters %}
|
||||
<p>Supporters of this edition include ungluers:
|
||||
{% for ungluer in campaign.ungluers.supporters %}
|
||||
{% if forloop.last %}and {% endif %}{{ ungluer.username }}{% if forloop.last %}. {% else %}, {% endif %}
|
||||
Unglued ebooks are made possible through the Unglue.it website by contributions from {{ transactions.all|length }} readers like you.</p>
|
||||
{% if transactions.supporters %}
|
||||
<p>Supporters of this edition:
|
||||
{% for transaction in transactions.supporters %}
|
||||
{% if forloop.last %}{% if transactions.supporters|length > 1 %}and {% endif %}{% endif %}{{ transaction.ack_name }}{% if forloop.last %}. {% else %}, {% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if campaign.ungluers.patrons %}
|
||||
<p>Benefactors of this edition include ungluers:
|
||||
{% for ungluer in campaign.ungluers.patrons %}
|
||||
{% if forloop.last %}and {% endif %}<a href="{% if ungluer.profile.home_url %}{{ungluer.profile.home_url}}{% else %}https://unglue.it{% url supporter supporter_username=ungluer.username %}{% endif %}">{{ ungluer.username }}</a>{% if forloop.last %}. {% else %}, {% endif %}
|
||||
{% if transactions.patrons %}
|
||||
<p>Benefactors of this edition:
|
||||
{% for transaction in transactions.patrons %}
|
||||
{% if forloop.last %}{% if transactions.patrons|length > 1 %}and {% endif %}{% endif %}{% if transaction.ack_link %}<a href="{{transaction.ack_link}}">{{ transaction.ack_name }}</a>{% else %}{{ transaction.ack_name }}{% endif %}{% if forloop.last %}. {% else %}, {% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if campaign.ungluers.bibliophiles %}
|
||||
<p>Bibliophiles of this edition include ungluers:<dl>
|
||||
{% for ungluer in campaign.ungluers.bibliophiles %}
|
||||
<dt><a href="{% if ungluer.profile.home_url %}{{ungluer.profile.home_url}}{% else %}https://unglue.it{% url supporter supporter_username=ungluer.username %}{% endif %}">{{ ungluer.username }}</a></dt><dd>{{ ungluer.profile.tagline }}</dd>
|
||||
{% if transactions.bibliophiles %}
|
||||
<p>Bibliophiles of this edition:<dl>
|
||||
{% for transaction in transactions.bibliophiles %}
|
||||
<dt>{% if transaction.ack_link %}<a href="{{transaction.ack_link}}">{{ transaction.ack_name }}</a>{% else %}{{ transaction.ack_name }}{% endif %}</dt><dd>{{ transaction.ack_dedication }}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if transactions.anons %}
|
||||
<p>We also gratefully acknowledge the support of {{ transactions.anons }} anonymous ungluer{% if transactions.anons > 1 %}s{% endif %}.</p>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<p>
|
||||
You can say thank you by supporting the ungluing of more books at <a href="https://unglue.it/">https://unglue.it/</a>
|
||||
</p>
|
||||
|
|
|
@ -782,6 +782,9 @@ class PledgeModifyView(FormView):
|
|||
work_id = self.kwargs["work_id"]
|
||||
preapproval_amount = form.cleaned_data["preapproval_amount"]
|
||||
anonymous = form.cleaned_data["anonymous"]
|
||||
ack_name = form.cleaned_data["ack_name"]
|
||||
ack_link = form.cleaned_data["ack_link"]
|
||||
ack_dedication = form.cleaned_data["ack_dedication"]
|
||||
|
||||
assert self.request.user.is_authenticated()
|
||||
user = self.request.user
|
||||
|
@ -807,7 +810,8 @@ class PledgeModifyView(FormView):
|
|||
p = PaymentManager(embedded=self.embedded)
|
||||
paymentReason = "Unglue.it Pledge for {0}".format(campaign.name)
|
||||
status, url = p.modify_transaction(transaction=transaction, amount=preapproval_amount, premium=premium,
|
||||
paymentReason=paymentReason)
|
||||
paymentReason=paymentReason, ack_name=ack_name, ack_link=ack_link,
|
||||
ack_dedication=ack_dedication)
|
||||
|
||||
logger.info("status: {0}, url:{1}".format(status, url))
|
||||
|
||||
|
@ -853,6 +857,9 @@ class PledgeRechargeView(TemplateView):
|
|||
# the recipients of this authorization is not specified here but rather by the PaymentManager.
|
||||
# set the expiry date based on the campaign deadline
|
||||
expiry = campaign.deadline + timedelta( days=settings.PREAPPROVAL_PERIOD_AFTER_CAMPAIGN )
|
||||
ack_name = transaction.ack_name
|
||||
ack_link = transaction.ack_link
|
||||
ack_dedication = transaction.ack_dedication
|
||||
|
||||
paymentReason = "Unglue.it Recharge for {0}".format(campaign.name)
|
||||
|
||||
|
|
Loading…
Reference in New Issue