I have a "Villa" Model with lots of descriptive TextFields. For each TextField, I have a copy which will be the Russian translation of the original field, which I'm naming by appending "_ru", for example "long_description" and "long_description_ru". I would like to exclude all the "_ru" fields from my ModelForm, which I thought I would be able to do like this:
class VillaForm(ModelForm):
class Meta:
model = Villa
exclude = []
for field_name in Villa.__dict__:
print field_name
if field_name.endswith("_ru"):
exclude.append(field_name)
However, Villa.__dict__
does not contain the TextFields - even though they get rendered by the ModelForm. Am I being very stupid here?