On Sun, 2008-04-20 at 02:20 -0700, Berco Beute wrote: > Using: Latest from trunk > > I'm using a custom widget for datetimefields: > > ====================================== > #models.py > class Event(models.Model): > endDateTime = models.DateTimeField('Finish', blank=True, > null=True) > > > #forms.py > class EventForm(forms.ModelForm): > endDateTime = forms.DateTimeField(widget=DateTimeWidget) > > class Meta: > model = Event > > ====================================== > > But somehow the 'endDateTime' field is still required when rendering > the form
All form fields default to required=True and you haven't changed that in your EventForm. You need to pass required=False to the form field if you don't want it to be required. > and the label is 'endDateTime' instead of 'Finish'. That's also expected. You have replaced the default form field with one of your own. On your replacement field, you haven't specified a label, so it uses the attribute name as the label. The new 'endDateTime' field you have specified in the form completely replaces any default form field that Django might otherwise have generated from your model for that field. It doesn't merge the two in some undefined manner. If you want it to have a custom label, you'll need to specify that on the form field. Regards, Malcolm -- Save the whales. Collect the whole set. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---