On Sep 20, 1:14 am, cerberos <[email protected]> wrote:
> I have a ModelForm form, I want to use a different widget than the
> default but when I do I lose the help_text.
>
> The first thing I tried was modelName.fieldName.help_text but it
> didn't work, I've tried all sorts in a shell but can't get the model's
> fields, I can't even get a list of the model's field names. How can I
> access it?

I'm answering my own question in the hope that it might help others.

Everything you need to know about a model is in ModelName._meta.

In my case I used ModelName._meta.get_field_by_name('field_name')
which returns (field_object, model, direct, m2m), so I used
ModelName._meta.get_field_by_name('field_name')[0].help_text.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to