我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用django.contrib.admin.widgets.AdminSplitDateTime()。
def __init__(self, *args, **kwargs): super(formAnuncio, self).__init__(*args, **kwargs) self.fields['data_inicio'].widget = widgets.AdminSplitDateTime() self.fields['data_fim'].widget = widgets.AdminSplitDateTime() if kwargs.get('instance'): id = kwargs.get('instance').id
def __init__(self, *args, **kwargs): super(formAnuncioEdit, self).__init__(*args, **kwargs) self.fields['data_inicio'].widget = widgets.AdminSplitDateTime() self.fields['data_fim'].widget = widgets.AdminSplitDateTime() if kwargs.get('instance'): id = kwargs.get('instance').id
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', })