[Fixed]-Django How to submit and handle form data in class based views

1👍

You can save object in your form_valid method:

def form_valid(self, form):
    model = YourModel()
    model.select_date = form.cleaned_data['select_date']
    model.select_meal = form.cleaned_data['meal']
    model.save()
    messages.success(request, "Your message here")
👤gamer

Leave a comment