Flesh out user donations panel a bit
This commit is contained in:
parent
010b2d666a
commit
94b283d0e9
|
@ -204,4 +204,4 @@ def reset_password(token):
|
|||
def panel():
|
||||
return render_template("panel.html",
|
||||
one_times=lambda u: [d for d in u.donations if d.type == DonationType.one_time],
|
||||
recurring=lambda u: next(d for d in u.donations if d.type == DonationType.recurring))
|
||||
recurring=lambda u: [d for d in u.donations if d.type == DonationType.monthly and d.active])
|
||||
|
|
|
@ -59,17 +59,20 @@ class Donation(Base):
|
|||
type = Column(ChoiceType(DonationType, impl=String()))
|
||||
amount = Column(Integer, nullable=False)
|
||||
created = Column(DateTime, nullable=False)
|
||||
emailed_about = Column(Boolean, nullable=False)
|
||||
updated = Column(DateTime, nullable=False)
|
||||
comment = Column(String(512))
|
||||
active = Column(Boolean)
|
||||
|
||||
def __init__(self, user, type, amount, project=None, comment=None):
|
||||
self.user = user
|
||||
self.type = type
|
||||
self.amount = amount
|
||||
self.created = datetime.now()
|
||||
self.updated = datetime.now()
|
||||
self.emailed_about = False
|
||||
self.project = project
|
||||
self.comment = comment
|
||||
self.active = True
|
||||
|
||||
def __repr__(self):
|
||||
return "<Donation {} from {}: ${} ({})>".format(
|
||||
|
|
|
@ -10,6 +10,35 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
{% if any(recurring(user)) %}
|
||||
<h2>Monthly Donations</h2>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10%"></th>
|
||||
<th>Date</th>
|
||||
<th>Amount</th>
|
||||
<th>Project</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for donation in recurring(user) %}
|
||||
<tr>
|
||||
<td>
|
||||
<form method="DELETE" action="cancel/{{ donation.id }}">
|
||||
<button type="submit" class="btn btn-danger btn-sm">Cancel</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>{{ donation.created.strftime("%Y-%m-%d") }}</td>
|
||||
<td>${{ "{:.2f}".format(donation.amount / 100) }}</td>
|
||||
<td>{{ donation.project.name if donation.project else "Not specified" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% if any(one_times(user)) %}
|
||||
<h2>One-time Donations</h2>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -28,5 +57,6 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<h3>Thanks!</h3>
|
||||
<p>You'll get an email when your money is going to be put to work.</p>
|
||||
<p>Have a great day!</p>
|
||||
|
|
Loading…
Reference in New Issue