# Path: pendulum/widgets.py
# class PendulumDateTimeWidget(forms.MultiWidget):
#     def __init__(self, attrs=None):
#         widgets = [DateWidget, TimeWidget]
#         super(PendulumDateTimeWidget, self).__init__(widgets, attrs)
# 
#     def decompress(self, value):
#         if value:
#             return [value.date(), value.time().replace(microsecond=0)]
#         return [None, None]
# 
#     def format_output(self, rendered_widgets):
#         # make things a little more accessible by adding labels to the output
#         date_id = time_id = ''
#         try:
#             date_id = re_id.findall(rendered_widgets[0])[0]
#         except:
#             pass
#         try:
#             time_id = re_id.findall(rendered_widgets[1])[0]
#         except:
#             pass
# 
#         return mark_safe(u'''<div class="datetime">
#     <label for="%s">Date:</label> %s<br />
#     <label for="%s">Time:</label> %s
# </div>''' % (date_id, rendered_widgets[0], time_id, rendered_widgets[1]))
# 
# Path: pendulum/utils.py
# DEFAULT_TIME_FORMATS = [
#     '%H:%M',        # 23:15         => 23:15:00
#     '%H:%M:%S',     # 05:50:21      => 05:50:21
#     '%I:%M:%S %p',  # 11:40:53 PM   => 23:40:53
#     '%I:%M %p',     # 6:21 AM       => 06:21:00
#     '%I %p',        # 1 pm          => 13:00:00
#     '%I:%M:%S%p',   # 8:45:52pm     => 23:45:52
#     '%I:%M%p',      # 12:03am       => 00:03:00
#     '%I%p',         # 12pm          => 12:00:00
#     '%H',           # 22            => 22:00:00
# ]


from django import forms
from pendulum.widgets import PendulumDateTimeWidget
from pendulum.utils import DEFAULT_TIME_FORMATS

class PendulumDateTimeField(forms.SplitDateTimeField):
    """
    This custom field is just a way to offer some more friendly ways to enter
    a time, such as 1pm or 8:15 pm
    """
    widget = PendulumDateTimeWidget
    def __init__(self, date_formats=None, time_formats=None, help_text=None, *args, **kwargs):

# Path: pendulum/widgets.py
# class PendulumDateTimeWidget(forms.MultiWidget):
#     def __init__(self, attrs=None):
#         widgets = [DateWidget, TimeWidget]
#         super(PendulumDateTimeWidget, self).__init__(widgets, attrs)
# 
#     def decompress(self, value):
#         if value:
#             return [value.date(), value.time().replace(microsecond=0)]
#         return [None, None]
# 
#     def format_output(self, rendered_widgets):
#         # make things a little more accessible by adding labels to the output
#         date_id = time_id = ''
#         try:
#             date_id = re_id.findall(rendered_widgets[0])[0]
#         except:
#             pass
#         try:
#             time_id = re_id.findall(rendered_widgets[1])[0]
#         except:
#             pass
# 
#         return mark_safe(u'''<div class="datetime">
#     <label for="%s">Date:</label> %s<br />
#     <label for="%s">Time:</label> %s
# </div>''' % (date_id, rendered_widgets[0], time_id, rendered_widgets[1]))
# 
# Path: pendulum/utils.py
# DEFAULT_TIME_FORMATS = [
#     '%H:%M',        # 23:15         => 23:15:00
#     '%H:%M:%S',     # 05:50:21      => 05:50:21
#     '%I:%M:%S %p',  # 11:40:53 PM   => 23:40:53
#     '%I:%M %p',     # 6:21 AM       => 06:21:00
#     '%I %p',        # 1 pm          => 13:00:00
#     '%I:%M:%S%p',   # 8:45:52pm     => 23:45:52
#     '%I:%M%p',      # 12:03am       => 00:03:00
#     '%I%p',         # 12pm          => 12:00:00
#     '%H',           # 22            => 22:00:00
# ]


# Path: pendulum/fields.py
from django import forms
from pendulum.widgets import PendulumDateTimeWidget
from pendulum.utils import DEFAULT_TIME_FORMATS


class PendulumDateTimeField(forms.SplitDateTimeField):
    """
    This custom field is just a way to offer some more friendly ways to enter
    a time, such as 1pm or 8:15 pm
    """
    widget = PendulumDateTimeWidget
    def __init__(self, date_formats=None, time_formats=None, help_text=None, *args, **kwargs):

        time_formats = time_formats or DEFAULT_TIME_FORMATS