Permalink
Browse files

Merge pull request #2 from a-musing-moose/account_dict_error

Account dict error
  • Loading branch information...
2 parents 8dadb6a + 974f86a commit 6ecb2fecbac311c1bf1de5dfc41f3b25a3401c95 Jonathan Moss committed Oct 30, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 accounts/abstract_models.py
@@ -206,16 +206,23 @@ def close(self):
self.save()
def as_dict(self):
- return {
+ data = {
'code': self.code,
- 'start_date': self.start_date.isoformat(),
- 'end_date': self.end_date.isoformat(),
+ 'start_date': '',
+ 'end_date': '',
'balance': "%.2f" % self.balance,
'redemptions_url': reverse('account-redemptions',
kwargs={'code': self.code}),
'refunds_url': reverse('account-refunds',
kwargs={'code': self.code})}
+ if self.start_date:
+ data['start_date'] = self.start_date.isoformat()
+ if self.end_date:
+ data['end_date'] = self.end_date.isoformat()
+ return data
+
+
class PostingManager(models.Manager):
"""

0 comments on commit 6ecb2fe

Please sign in to comment.