我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用django.contrib.admin.widgets.AdminDateWidget()。
def _get_form_fields(self): return OrderedDict(( (self.lookup_kwarg_gte, forms.DateField( label='', widget=AdminDateWidget(attrs={'placeholder': _('From date')}), localize=True, required=False )), (self.lookup_kwarg_lte, forms.DateField( label='', widget=AdminDateWidget(attrs={'placeholder': _('To date')}), localize=True, required=False )), ))
def setUp(self): class TestForm(forms.Form): char = forms.CharField(max_length=255) hidden = forms.CharField(max_length=255, widget=forms.HiddenInput()) date = forms.DateField(widget=AdminDateWidget()) datetime = forms.DateTimeField(widget=AdminSplitDateTime()) self.form = TestForm({ 'char': 'hi there', 'hidden': 'hidden text', 'date': '20140111', })