Re: change help_text if form_for_model used...

2007-05-25 Thread Jens Diemer

Jens Diemer schrieb:
> How can i change the help_text after i have generate the form with 
> form_for_model() ?

I found a solution:

--
from django.contrib.auth.models import User
UserForm = forms.form_for_model(User, fields=("username", "password"))
# change the help_text:
UserForm.base_fields['password'].help_text = ""
--


-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.org


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: change help_text if form_for_model used...

2007-05-25 Thread Malcolm Tredinnick

On Fri, 2007-05-25 at 10:02 +0200, Jens Diemer wrote:
> 
> How can i change the help_text after i have generate the form with 
> form_for_model() ?

At some point you shouldn't be afraid to read the relevant code in
newforms, since it is very well commented and answers to questions like
this just fall out.

The help_text is just an attribute on Field classes. A Form class
contains a "base_fields" attribute mapping field names to Field
sub-classes and a Form instance contains a fields attribute as well. So
rummage around inside one of those to change what you need. See the
source for an explanation of the difference between "base_fields" and
"fields".

Regards,
Malcolm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



change help_text if form_for_model used...

2007-05-25 Thread Jens Diemer


How can i change the help_text after i have generate the form with 
form_for_model() ?


-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.org


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---