Re: ModelForm and required fields

2008-06-03 Thread Mayank Dhingra
did u try using the required parameter ? In my case the default behavior was required and i changed it to not-required by adding "required=False" like name = forms.CharField(widget=forms.TextInput(attrs=class_txtbox), required=False) On May 2, 10:18 am, zmalloc <[EMAIL PROTECTED]> wrote: >

ModelForm and required fields

2008-05-01 Thread zmalloc
ModelForm currently does not provide anything like class="required" on rendered forms where fields are required. This has led me to create the fields manually in the form and add the style attribute to the widget. Doing this, I then lose help_text definitions created in the model. So I can

Re: ModelForm and required fields

2007-12-23 Thread Joseph Kocherhans
On 12/23/07, Julien <[EMAIL PROTECTED]> wrote: > > Hi there, > > I don't understand why the form doesn't validate when I don't fill out > a ManyToManyField. > > Here's the code: > > class Participant(models.Model): > project = models.ForeignKey(Project, related_name='participants') >

Re: ModelForm and required fields

2007-12-23 Thread Julien
Oh, and here's the view: def edit_participant(request, project_pk, participant_pk): project = get_object_or_404(Project, pk = project_pk) participant = get_object_or_404(Participant, pk = participant_pk) if request.method == 'POST': form =

ModelForm and required fields

2007-12-23 Thread Julien
Hi there, I don't understand why the form doesn't validate when I don't fill out a ManyToManyField. Here's the code: class Participant(models.Model): project = models.ForeignKey(Project, related_name='participants') roles = models.ManyToManyField(Role, blank=True, null=True) user =