Permalink
Browse files

Member data and edit link email functionality implemented

  • Loading branch information...
1 parent 8ca8ac0 commit 487bf53ed691e9e61b99b34a3496ec059b6574f5 @anttihirvonen committed Sep 14, 2012
View
13 dotmembership/apps/members/models.py
@@ -7,6 +7,8 @@
from django.core.mail import send_mail
from django.core.signing import TimestampSigner
from django.core.urlresolvers import reverse
+from django.contrib.sites.models import Site
+from django.conf import settings
from model_utils import Choices
@@ -56,6 +58,16 @@ def edit_link(self):
"""
return reverse("members-edit_member", args=[self.timestamped_id])
+ def send_data_and_edit_link(self):
+ subject = _(u"Jäsentietosi sekä muokkauslinkki")
+ fields = self.PUBLIC_FIELDS
+ # TODO: add invoicing details
+ body = render_to_string("members/mails/data_and_edit_link.txt",
+ {'member': self,
+ 'base_url': "http://{0}".format(Site.objects.get_current().domain),
+ 'fields': fields})
+ send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [self.email])
+
def __unicode__(self):
return "{0}, {1} ({2})".format(self.last_name, self.first_name, self.id)
@@ -70,7 +82,6 @@ def create_first_invoice_and_send_welcome_email(sender, instance, created, **kwa
# TODO: fast hack, refactor this later...
import datetime
from dotmembership.apps.billing.models import Invoice
- from .forms import MemberForm
from django.conf import settings
# TODO: don't hardcode amount
View
22 dotmembership/apps/members/templates/members/mails/data_and_edit_link.txt
@@ -0,0 +1,22 @@
+{% load members_extra %}
+Hei,
+
+alla näet tämänhetkiset jäsentietosi. Voit editoida tietojasi linkin
+{{ base_url }}{{ member.edit_link }}
+kautta (linkki on voimassa 30 minuuttia tästä hetkestä eteepäin).
+
+### Jäsentiedot ###
+
+{% for field in fields %}{{ member|getfieldname:field|capfirst }}: {{ member|getfield:field|default:"(Tyhjä)" }}
+{% endfor %}
+
+
+TODO: lisää tiedot jäsenmaksuista
+
+
+
+Muista vierailla tapahtumissamme! Katso tulevat saunaillat ja muut kivat
+sivuiltamme osoitteesta http://dot.ayy.fi.
+
+--
+Digitaalisen median ammattiainekerho DOT ry

0 comments on commit 487bf53

Please sign in to comment.