Skip to content

Instantly share code, notes, and snippets.

View chewthemonkey's full-sized avatar

Grant Anderson chewthemonkey

View GitHub Profile
@chewthemonkey
chewthemonkey / form_fields.py
Last active October 12, 2020 12:04
Django model and form field for user friendly Python date format.
from django import forms
from ..utils import get_date_format_parts
class DateFormatWidget(forms.MultiWidget):
"""
Widget to allow multiple input for a Python date format (e.g. '%Y-%m-%d')
with select choices for the date elements and input for any separator characters.
"""