def field(self): from wagtail.admin.widgets import AdminDateTimeInput field_kwargs = { 'widget': AdminDateTimeInput(format=self.format), } field_kwargs.update(self.field_options) return forms.DateTimeField(**field_kwargs)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['page_chooser'].widget = AdminPageChooser() self.fields['image_chooser'].widget = AdminImageChooser() self.fields['document_chooser'].widget = AdminDocumentChooser() self.fields['snippet_chooser'].widget = AdminSnippetChooser(Page) self.fields['date'].widget = AdminDateInput() self.fields['time'].widget = AdminTimeInput() self.fields['datetime'].widget = AdminDateTimeInput() self.fields['auto_height_text'].widget = AdminAutoHeightTextInput() self.fields['default_rich_text'].widget = get_rich_text_editor_widget('default')
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["page_chooser"].widget = AdminPageChooser() self.fields["image_chooser"].widget = AdminImageChooser() self.fields["document_chooser"].widget = AdminDocumentChooser() self.fields["snippet_chooser"].widget = AdminSnippetChooser(Page) self.fields["date"].widget = AdminDateInput() self.fields["time"].widget = AdminTimeInput() self.fields["datetime"].widget = AdminDateTimeInput() self.fields["auto_height_text"].widget = AdminAutoHeightTextInput() self.fields["default_rich_text"].widget = get_rich_text_editor_widget( "default") self.fields["switch"].widget = SwitchInput() self.fields["disabled_switch"].widget = SwitchInput( attrs={"disabled": True})
def __init__(self, *args, **kwargs): """ __init__ """ super().__init__(*args, **kwargs) self.fields['publish_datetime'].widget = AdminDateTimeInput()