How to manually add a datetime input element to a Django template without using forms

38 Views Asked by At

I want to manually add date-time input elements to an HTML where needed, but as the targets should be dynamic, I cannot use forms. Is there a way to achieve this with JS? Something like this (or ways to achieve similar results):

$('#my-target-div').djangoDatetime()

Or

$('#my-anchor-button').djangoDatetime({target: '#my-input-element'})

I want to also have Django's field buttons (like calendar, date picker, ...) included.

I saw Django's built-in DateTimeShortcuts.js, but I couldn't achieve what I planned.

0

There are 0 best solutions below