Maybe I'm missing something here but I've been struggling with some
basic forms customization issues.

I'm using ver. 1.0

I have created a simple model (Metric) and a form to go with it,
deriving from django.forms.ModelForm with the model set it the Meta as
per the examples.

Out-of-the-box the form is ugly (understandably so) so I need to
control its appearance, e.g. hook a calendar widget to a date field,
control the size of input fields etc.

This can be done by overriding fields, e.g.:

class MetricForm(ModelForm):
        # Override some fields to customize the appearance
        iter = forms.CharField(widget=forms.TextInput(attrs={'size':'3'}))
        end_date = forms.CharField(widget=forms.TextInput(attrs=
{'class':'date-pick', 'size':'10'}))
        class Meta:
            model = Metric

Now the thing is that for fields I override, I lose the help_text I
have set in the model, I lose the value entered in an input being
echoed back to the user when validation fails, I lose the
verbose_name...

So I'm looking at the data available in the template to try to get my
hands dirty and restore all this manually but can't find how all this
magic works. I'm in the debugger looking at the form passed to the
template via the context and this looks like a mountain I'd rather not
climb (I'll spare you the details of the data structure here).

Suggestion appreciated.

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