Permalink
Browse files

Merge pull request #1 from mcordes/master

Here you go.
  • Loading branch information...
2 parents dc2fd9e + 23be6cc commit 174eaa9274170f45de98ffbe7deda7f37a34a829 @reinbach committed Dec 2, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 djmoney/models/fields.py
View
@@ -23,8 +23,11 @@ def __init__(self, field):
self.currency_field_name = currency_field_name(self.field.name)
def _money_from_obj(self, obj):
- return Money(obj.__dict__[self.field.name], obj.__dict__[self.currency_field_name])
-
+ amount = obj.__dict__[self.field.name]
+ if amount is None:
+ return None
+ return Money(amount, obj.__dict__[self.currency_field_name])
+
def __get__(self, obj, type=None):
if obj is None:
raise AttributeError('Can only be accessed via an instance.')

0 comments on commit 174eaa9

Please sign in to comment.