common.widgets module

class common.widgets.DateWidget(attrs=None, end=False, required=False)[source]

Bases: django.forms.widgets.Widget

A Widget that splits date input into two <select> boxes for month and year, with ‘day’ defaulting to the first of the month.

Based on SelectDateWidget, in

django/trunk/django/forms/extras/widgets.py

none_value = (0, 'Month')
day_field = '%s_day'
month_field = '%s_month'
year_field = '%s_year'
sqeeze_form_group(html, width=4)[source]
render(name, value, attrs=None, renderer=None)[source]

Render the widget as an HTML string.

classmethod id_for_label(id_)[source]

Return the HTML ID attribute of this Widget for use by a <label>, given the ID of the field. Return None if no ID is available.

This hook is necessary because some widgets have multiple HTML elements and, thus, multiple IDs. In that case, this method should return an ID value that corresponds to the first ID in the widget’s tags.

property media
value_from_datadict(data, files, name)[source]

Given a dictionary of data and this widget’s name, return the value of this widget or None if it’s not provided.