📅  最后修改于: 2022-03-11 14:45:08.651000             🧑  作者: Mango
from django import forms
from .models import Booking
import datetime
class BookingForm(forms.ModelForm):
class Meta:
model = Booking
fields = ('booking_name', 'rental_price',
'book_car', 'customer_name', 'times_pick',)
widgets = {
'times_pick': DateTimePickerInput(
options={
'minDate': (datetime.datetime.today() + datetime.timedelta(days=1)).strftime('%Y-%m-%d 00:00:00'),
'maxDate': (datetime.datetime.today() + datetime.timedelta(days=2)).strftime('%Y-%m-%d 23:59:59'),
'enabledHours': [8, 9, 10, 11, 12, 13, 14, 15, 16, 17],
}
),
}