Python django.contrib.admin.widgets.AdminDateWidget() Examples
The following are 4
code examples of django.contrib.admin.widgets.AdminDateWidget().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.contrib.admin.widgets
, or try the search function
.
Example #1
Source File: filter.py From django-admin-rangefilter with MIT License | 6 votes |
def _get_form_fields(self): return OrderedDict( ( (self.lookup_kwarg_gte, forms.DateField( label='', widget=AdminDateWidget(attrs={'placeholder': _('From date')}), localize=True, required=False, initial=self.default_gte, )), (self.lookup_kwarg_lte, forms.DateField( label='', widget=AdminDateWidget(attrs={'placeholder': _('To date')}), localize=True, required=False, initial=self.default_lte, )), ) )
Example #2
Source File: tests.py From celery-monitor with GNU General Public License v3.0 | 5 votes |
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', })
Example #3
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_DateField(self): self.assertFormfield(Event, 'start_date', widgets.AdminDateWidget)
Example #4
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_attrs(self): w = widgets.AdminDateWidget() self.assertHTMLEqual( w.render('test', datetime(2007, 12, 1, 9, 30)), '<input value="2007-12-01" type="text" class="vDateField" name="test" size="10">', ) # pass attrs to widget w = widgets.AdminDateWidget(attrs={'size': 20, 'class': 'myDateField'}) self.assertHTMLEqual( w.render('test', datetime(2007, 12, 1, 9, 30)), '<input value="2007-12-01" type="text" class="myDateField" name="test" size="20">', )