[Answered ]-DateTimeField not shown in a template – django

1πŸ‘

βœ…

the problem might be this 'type': "datetime-local"

try this
try to change your datetime to something like this

'start_appointment': forms.DateTimeInput(format='%Y-%m-%d %H:%M:%S', attrs={'class':'datetimefield'}) 

and for datetimepicker you can use something like this

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
    <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
    
    
    <script>
        window.addEventListener("DOMContentLoaded", function () {
            flatpickr(".datetimefield", {
                enableTime: true,
                enableSeconds: true,
                dateFormat: "Y-m-d H:i:S",
            });
        });

</script>

you can learn more on Flatpickr here https://flatpickr.js.org/

Leave a comment