Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added membership payment details to edit page

  • Loading branch information...
commit 953418c7f77a1355c82202a80da23d12459c2892 1 parent 5060e98
@anttihirvonen authored
View
6 dotmembership/apps/billing/models.py
@@ -44,6 +44,10 @@ class Invoice(models.Model):
reference_number = models.IntegerField(_(u"viitenumero"), blank=True, null=True, editable=False)
+ @property
+ def paid(self):
+ return self.status == self.STATUS.paid
+
def clean(self):
from django.core.exceptions import ValidationError
if self.status == self.STATUS.paid and not (self.payment_date and self.payment_method):
@@ -81,6 +85,8 @@ class Meta:
def calculate_reference_number(sender, instance, created, **kwargs):
"""
Calculates reference number for
+ #TODO: this should be probably moved to save(), as it modifies
+ the instance
"""
if created:
# One-liner to calculate reference number :)
View
20 dotmembership/apps/members/templates/members/edit.html
@@ -1,9 +1,29 @@
{% extends "base_content.html" %}
{% load bootstrap %}
+{% load members_extra %}
{% block title %}Hei {{ member.first_name }}!{% endblock %}
{% block site_content %}
<div class="row">
<div class="span12">
+ <h3>Tämän vuoden jäsenmaksu</h3>
+ {% if years_invoice %}
+ {% if years_invoice.paid %}
+ <p>Olet maksanut vuoden {{ years_invoice.for_year }} jäsenmaksun.</p>
+ {% else %}
+ <p>Et ole maksanut vuoden {{ years_invoice.for_year }} jäsenmaksua. Maksutiedot löydät alta.</p>
+ <div class="row member-data">
+ {% print_row "Saaja" "DOT ry" %}
+ {% print_row "IBAN" "FI36 1309 3000 2025 49" %}
+ {% print_row "BIC" "NDEAFIHH" %}
+ {% print_row "Viitenumero" years_invoice.reference_number %}
+ {% print_row "Summa" years_invoice.amount " euroa" %}
+ {% print_row "" "<i>Mikäli maksat enemmän, tulkitaan ylimenevä osa lahjoitukseksi. :)</i>" %}
+ {% print_row "Eräpäivä" years_invoice.due_date %}
+ </div>
+ {% endif %}
+ {% else %}
+ <p>Kuluvan vuoden jäsenmaksujalaskuja ei ole vielä lähetetty jäsenille.</p>
+ {% endif %}
<h3>Muokkaa sähköpostiosoitettasi</h3>
<form action="" method="POST" class="form form-horizontal">
{% csrf_token %}
View
9 dotmembership/apps/members/views.py
@@ -9,6 +9,7 @@
from django_mailman.models import List
from ajaxutils.decorators import ajax
+import datetime
from .forms import MemberForm, EmailForm, MemberJoinForm, MemberEmailEditForm
from .models import Member
@@ -174,6 +175,12 @@ def edit(request, signed_id):
else:
messages.error(request, "Korjaa virheet.")
+ try:
+ years_invoice = member.invoices.get(for_year=datetime.date.today().year)
+ except Invoice.DoesNotExist:
+ years_invoice = None
+
return render(request, "members/edit.html", {"member": member,
"member_form": member_form,
- "email_form": email_form})
+ "email_form": email_form,
+ "years_invoice": years_invoice})
Please sign in to comment.
Something went wrong with that request. Please try again.