from django.forms.widgets import Input from django.forms.utils import flatatt from django.utils.safestring import mark_safe from django.template import Context, Template from django.template.loader import get_template class DateTimePicker(Input): def render(self, name, value, attrs=None): super().render(name, value, attrs) flat_attrs = flatatt(attrs) html = '''{% load static %}''' html += ''' '''%{'attrs':flat_attrs, 'id':attrs['id']} template = Template(html) context = Context({}) return template.render(context)