views:

39

answers:

1

I'm using Thauber's lovely Django schedule app, but have run into a problem: I can't figure out how to exclude the time portion of the datetime field.

My form class and lame exclusion attempt looks like this:

 class LaundryDeliveryForm(EventForm):
    start = forms.DateTimeField(widget=forms.SplitDateTimeWidget)
    end = forms.DateTimeField(widget=forms.SplitDateTimeWidget, help_text = ("The end time must be later than start time."))
    class Meta:
        model = LaundryDelivery 
        exclude = EventForm.Meta.exclude + ('active', 'start.time')

Ideally, I'd like to just store the day, or store the start.time as some arbitrary time like 8 a.m., but while the active field is happily excluded, the time field remains open.

Tried sifting through the documentation but couldn't track what I needed down.

+2  A: 

You can use, DateInput widget as widget for current form, or forms.DateField(), which has default DateInput widget.

simplyharsh
Ok, that was very helpful! But now I lose my beautiful calendar widget since it switches the id on it from id="id_start_0" to id="id_start". All the CSS that comes with Thauber's module is aligned to the latter naming convention, any ideas on how I can keep the ID_0 with the date picker?
Michael Morisy
Ok, thinking about it some more I might be asking for the impossible/impractical and should just suck up and fix the CSS.
Michael Morisy