Well I experimented with your tips Daniel, and put this in my forms
file:
class SurveyForm(forms.ModelForm):
name = forms.CharField(max_length=50, widget=forms.TextInput(attrs=
{'size':'50'}))
class Meta:
model = Survey
And it works. I assume I just add the ones above that I
Thanks Andy
On Jan 15, 1:50 pm, Andy Mckay wrote:
> I don't think you are defining the ModelForm correctly, the whole
> point is that Django creates the fields for you. If you look at:
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms
>
> This is the key
I don't think you are defining the ModelForm correctly, the whole
point is that Django creates the fields for you. If you look at:
http://docs.djangoproject.com/en/dev/topics/forms/modelforms
This is the key difference between a ModelForm and a normal form:
Thanks for the tips Dan, I thought the DRY thing could not be right.
Not sure I understand tho - I originally made the form with just the
inner Meta class definition - do you do that and then override things
that need to change (e.g. where I want to use a longer TextInput
widget or whatever.
On Jan 15, 5:35 pm, Peter Bailey wrote:
> I have just recently started using forms. I was avoiding them because
> I thought they were not very DRY, but discovered I need them for added
> flexibility such as displaying field lengths for example.
>
> Anyway, I have created a
On 15-Jan-09, at 9:35 AM, Peter Bailey wrote:
> Anyway, I have created a Form for a Survey object that I use. If I go
> to my edit page for a Survey, everything works perfectly. If I go to
> do a simple add new (like right out of the docs), I always receive an
> error "NoneType' object is not
I have just recently started using forms. I was avoiding them because
I thought they were not very DRY, but discovered I need them for added
flexibility such as displaying field lengths for example.
Anyway, I have created a Form for a Survey object that I use. If I go
to my edit page for a
7 matches
Mail list logo