I have some code that is passed on instance of a CharField. Is there any way I can figure out what model class this field belongs to?
A:
I assume you mean what ModelForm this field belongs to...
From looking at django.forms.Field and the __dict__
on a CharField, it appears that the answer is "no". You'll have to pass the Form or Model class as necessary.
rz
2010-03-28 00:23:26