Thanks foy your replies.
The class Fondo has in truth lots of Textfield to be displayed as CharField
(I am using django.forms to implement a search mask); the one posted was
only an excerpt.
I solved this way:

class FondoForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(FondoForm, self).__init__(*args, **kwargs)
 for nome, campo in self.fields.items():
self.fields[nome].required = False
 if type(campo.widget) == forms.Textarea:
self.fields[nome].widget = forms.TextInput()

class Meta:
model = Fondo

On Tue, Jan 26, 2010 at 16:05, KrcK --- <[email protected]> wrote:
> You can try this:
>
> class Fondo(models.Model):
> denominazione = models.CharField(max_length=200)
> storia        = models.TextField(blank=True)
> class FondoForm(forms.ModelForm):
>     storia = forms.CharField(widget=forms.Textarea)
>
> class Meta:
> model = Fondo
>
> I am not sure if this works.
>
>
>
> 2010/1/26 Daniel Roseman <[email protected]>
>>
>> On Jan 26, 11:45 am, Massimiliano della Rovere
>> <[email protected]> wrote:
>> > I use django 1.1.1 and I defined:
>> >
>> > class Fondo(models.Model):
>> > denominazione = models.CharField(max_length=200)
>> >  storia        = models.TextField(blank=True)
>> >
>> > class FondoForm(forms.ModelForm):
>> >  class Meta:
>> >  model = Fondo
>> >  widgets = {'storia': forms.TextInput}
>> >
>> > but the 'storia' field is still shown as TextArea. Can you tell me
where
>> > do
>> > I err?
>>
>> The 'widgets' Meta option on modelforms is only available in the
>> development version. You seem to be using the wrong documentation -
>> you should be looking at
>> http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/
>>
>> (Also it seems that the dev docs are missing the 'new in development
>> version' tag there.)
>> --
>> DR.
>>
>> --
>> 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]<django-users%[email protected]>
.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> 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]<django-users%[email protected]>
.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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