Django - Get string from ModelForm field label
I've got the following: I want to add a string to my ModelForm field
labels. I want to do it in the form class.
I do this:
class MyForm(ModelForm):
class Meta():
model = MyEntity
def __init__(self, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
for key in self.fields:
self.fields[key].label = "-- " + self.fields[key].label
I always get the following in my template:
-- django.utils.functional.proxy object at 0x04605E10>
The label contains in proxy___args under 0 the correct label. How can I
get this shitty label? Can't be that hard, can it?
Thanks!
No comments:
Post a Comment