Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
How to limit the input in DateTime picker?

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:

  1. For the Date:

    • from today to lets say 1 year ahead
  2. For the Time:

    • from the current local time(so if the date is today, they won't be able to pick a time before the current local time)
    • afterwards every day from 10:00 until 21:00

Is there a way to do that? Thank You!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!