1 2 3 4 5 6 7 8 9 | import django.newforms as forms
import datetime
class DateTextInput(forms.TextInput):
def render(self, name, value, attrs=None):
if (type(value) == datetime.date):
value = value.strftime("%d.%m.%Y")
return super(DateTextInput, self).render(name, value, attrs)
|
More like this
- Drop down Datefield by lurker 5 years, 8 months ago
- Custom DateField To Handle Credit Card Exp Date. Format: MM/YY by pjs 4 years, 10 months ago
- RangeField and RangeWidget by marinho 4 years, 7 months ago
- Widget for DateTime values on Geraldo Reports by marinho 4 years, 1 month ago
- boostrap prepend-input for widgets by DimmuR 7 months, 3 weeks ago
Comments
I've created a similar date widget. One possible enhancement would be to automatically size it in render if not otherwise specified:
#