Проблемы с моей Django формой ; возвращает недействительный

Я продолжаю получать form.is_valid, возвращающий false из моей формы Django

Вот мой views.py

def book_bus(request):

  if request.method == 'POST' :

    form = bookbusform(request.POST)

    if form.is_valid() :

      cd = form.cleaned_data

      current_loc = cd['current_location']

      destination = cd['Destination']

      departure = cd['departure_date']                                      User = get_user_model()                                               if 'booknow' in request.POST  :

        user = User.objects.get(phone_number=request.user.phone_numbe>

        booking = Booking.objects.create(current_Location = current_l>

        booking.created_by  = user

        booking.save()                                                        return redirect('payonline')

      else :

        user = User.objects.get(phone_number=request.user.phone_numbe>

        booking = Booking.objects.create(current_Location = current_l

        booking.created_by  = user

        booking.save()

        return redirect('home')

                                                                          else :

      return redirect('error-page')

  else :

    form = bookbusform()

    context = {                                                             'form' : form

      }

    return render(request,'bookbus.html',context)

Мой файл forms.py

class bookbusform(forms.Form) :

  current_location =  forms.ChoiceField(choices = Bus_Terminal.objects.values_list("id","name"),widget = forms.Select(attrs={"class":"selec>

  Destination = forms.ChoiceField(choices = Bus_Terminal.objects.none(),widget = forms.Select(attrs={"class":"select","id":"Des"}))

  departure_date = forms.DateField(widget = forms.DateInput(attrs={"type":"date","min":min_date,"max":max_date}))
Вернуться на верх