Friendly duration picker ready to be used as a form widget in a Django application

69 Views Asked by At

I need to let a user select a duration in a form field of a Django application.

I'm already using bootstrap 4 (namely django-bootstrap-datepicker-plus) to select other fields such as Date, Time and DateTime. But the "duration" type is something lightly different.

I'm currently having a simple integer field where the user is asked to input the duration value in minutes. But once the duration last for some hours, e.g. 07h24, the user has to compute to how many minutes it corresponds before entering the right value. This is error prone. On the opposite, if I ask the user to input values in hours, 7h20 would become 7.3333. This is also error prone and it's not precise in that case.

That's why I'm searching for a true duration picker. Using two DateTime pickers and computing the timedelta is also not an option for the lack of user-friendliness.

Hence my question: does a friendly duration picker exists inside bootstrap for Django and if not, does something other exist? I guess I don't have to reinvent the wheel, but I wasn't able to figure out something which integrates well with Django 4.

Ideally, jQuery should also be avoided.

My current research led me to these tools, but they can't be easily integrated into a Django application (as a form widget):

I also found this thread:
https://groups.google.com/g/django-developers/c/_hCR4JzX8aM
which refers to this ticket, but there isn't much activity around it:
https://code.djangoproject.com/ticket/28354

0

There are 0 best solutions below