membership fixes.
authorgniibe <gniibe@atom.fsij.org>
Tue, 4 Aug 2009 04:55:17 +0000 (13:55 +0900)
committergniibe <gniibe@atom.fsij.org>
Tue, 4 Aug 2009 04:55:17 +0000 (13:55 +0900)
ChangeLog
membership/models.py
membership/views.py
templates/membership/member_list.html

index d50d41f..667779e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-08-04  Niibe Yutaka  <gniibe@fsij.org>
 
+       * membership/models.py (MemberPayment.__unicode__): Bug fix,
+       adding self.
+
+       * templates/membership/member_list.html: Show the value of
+       m.email (was: m.user.email).
+
+       * membership/views.py (register_member_email): Check user.
+       (member_email): Get email from member (was: member.user).
+
        * membership/models.py: Import django.core.exceptions.
        (Member): first_name and last_name can be blank.
        (Member.name): Returns first_name concatinated with last_name.
index b611c88..fa407a0 100644 (file)
@@ -64,10 +64,10 @@ class MemberPayment(models.Model):
     contribution = models.IntegerField() # Kuchi-Suu in Japanese
     le = models.ForeignKey(LedgerEntry, unique=True, blank=True, null=True)
     def __unicode__(self):
-        if fee_year == 9999:
+        if self.fee_year == 9999:
             payment_fee_str = u'入会金'
         else:
-            payment_fee_str = "%04d" % self.fee
+            payment_fee_str = "%04d" % self.fee_year
         return self.member.__unicode__() + "/" + payment_fee_str
 
 def get_valid_member(year):
index 1670c6e..89cc990 100644 (file)
@@ -18,7 +18,7 @@ def member_email(request, member, manage=False):
         del request.session['member_email_data']
         errors = addr['errors']
     except (KeyError):
-        email = member.user.email
+        email = member.email
     try: referrer = request.META['HTTP_REFERER']
     except: referrer = None
     if referrer:
@@ -44,8 +44,9 @@ def register_member_email(request, member):
         return HttpResponseRedirect(request.POST['original_path'])
     member.email = email
     member.save()
-    member.user.email = email
-    member.user.save()
+    if member.user:
+        member.user.email = email
+        member.user.save()
     return HttpResponseRedirect(request.POST['original_path'])
 
 def member_address(request, member, manage=False):
index 21f5c28..1fc4a5a 100644 (file)
@@ -20,7 +20,7 @@
   <td><a href="../{{ m.member_id }}/address/" target="edit">
 {% if m.memberaddress_set.get %}{{ m.memberaddress_set.get.zip_code }}{% else %}新規作成{% endif %}</a></td>
   <td><a href="../{{ m.member_id }}/payment/" target="edit">{{ m.memberpayment_set.count }}</a></td>
-  <td><a href="../{{ m.member_id }}/email/" target="edit">{{ m.user.email }}</a></td>
+  <td><a href="../{{ m.member_id }}/email/" target="edit">{{ m.email }}</a></td>
 </tr>
 {% endfor %}
 </table>