On Wed, Jan 9, 2013 at 4:07 PM, Vijay Shanker <deontics@gmail.com> wrote:
i rephrased the question.thanks for the help extended so far.
http://stackoverflow.com/questions/14214530/issues-in-example-custom-field-i...
Mention what you are trying to achieve when you ask a question. Otherwise how somebody can help you? Seeing your implementation I don't get any idea what you are trying to do. It doesn't look like something that requires a custom ModelField. Anyway the i guess the reason that it is getting called twice is, you have __metaclass__ django.db.models.SubFieldBase which will call to_python() every time you try to set an attribute in a class which is created by metaclass SubFieldBase. In the course of execution some where as part of validation it is trying to access the 'editor_id' which will give an AttributeError, followed by a setattr on that ProfiledUserField in turn to_python gets called with a None value. I didn't investigate much so my guess might be wrong. Try using a pdb and follow the path. PS: If you are mentioning what you want to achieve, there may be better solutions than writing custom Model Field. -- blog : ragsagar.wordpress.com mail id : python -c "print '@'.join(['ragsagar','.'.join([x for x in ['gmail','com']])])"