Permalink
Browse files

make lookups work better

  • Loading branch information...
1 parent 6ffd552 commit 522c87607e6417ed4f9e5775dbf1f92a875354b7 @stefanfoulis committed Sep 1, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 phonenumber_field/modelfields.py
@@ -54,9 +54,12 @@ def get_internal_type(self):
def get_prep_value(self, value):
"Returns field's value prepared for saving into a database."
- # Need to convert File objects provided via a form to unicode for database insertion
if value is None:
return None
+ value = to_python(value)
+ if isinstance(value, basestring):
+ # it is an invalid phone number
+ return value
return value.as_e164
def contribute_to_class(self, cls, name):

0 comments on commit 522c876

Please sign in to comment.