Skip to content
Browse files

Adding field name to assertion error when assigning invalid object to

foreign key field, fixes #49 (pull req had a syntax error)
  • Loading branch information...
1 parent 0994f90 commit 7f9c2720d278f9112f2db9b4a8b4770daee8733b @coleifer committed Jan 30, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 peewee.py
View
2 peewee.py
@@ -2043,7 +2043,7 @@ def __set__(self, instance, obj):
if isinstance(obj, int):
setattr(instance, self.field_column, obj)
else:
- assert isinstance(obj, self.to), "Cannot assign %s, invalid type" % obj
+ assert isinstance(obj, self.to), "Cannot assign %s to %s, invalid type" % (obj, sel.field.name)
@karlb
karlb added a note Jan 30, 2012

There an "f" missing in "sel.field.name"

@coleifer
Owner
coleifer added a note Jan 30, 2012

derp thanks mane 46f073d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
setattr(instance, self.field_column, obj.get_pk())
setattr(instance, self.cache_name, obj)

0 comments on commit 7f9c272

Please sign in to comment.
Something went wrong with that request. Please try again.