def __setattr__(self, name, value):
field = self.get_field(name)<EOL>if field:<EOL><INDENT>try:<EOL><INDENT>value = field.to_python(value, pytz.utc)<EOL>field.validate(value)<EOL><DEDENT>except ValueError:<EOL><INDENT>tp, v, tb = sys.exc_info()<EOL>new_msg = "<STR_LIT>".format(v, name)<EOL>reraise(tp, tp(new_msg), tb)<EOL><DEDENT><DEDENT>super(Model, self).__setattr__(name, value)<EOL>
When setting a field value, converts the value to its Pythonic type and validates it.
This may raise a `ValueError`.