I am making a django app which is going to collect data from a form. In the form I'm gonna put some normal fields and a DateTime field, but I wanna limit that DateTime field so the user can only select:
For the Date:
For the Time:
Is there a way to do that? Thank You!
You can do backend validation in django by using the model's clean method https://docs.djangoproject.com/en/3.2/ref/models/instances/#django.db.models.Model.clean
If you want a better user experience, you need to do that with javascript. The way you solve it there depends on the tool you use. (e.g. jquery Datepicker?) This validates the input before you submit the form to the server.