File tree Expand file tree Collapse file tree 2 files changed +7
-17
lines changed
Expand file tree Collapse file tree 2 files changed +7
-17
lines changed Original file line number Diff line number Diff line change 11from django .db import models
22from wagtail .admin .panels import FieldPanel
3- from wagtail .admin .panels import FieldPanel as StreamFieldPanel
43from wagtail .fields import StreamField
54from wagtail .models import Page
65
@@ -42,5 +41,5 @@ class PageWithStreamfield(Page):
4241 )
4342
4443 content_panels = Page .content_panels + [
45- StreamFieldPanel ("body" ),
44+ FieldPanel ("body" ),
4645 ]
Original file line number Diff line number Diff line change 44
55
66class NativeColorPanel (FieldPanel ):
7- def widget_overrides (self ):
8- # For Wagtail<3.0 we use widget_overrides
9- return {
10- self .field_name : ColorInputWidget (),
11- }
12-
137 def get_form_options (self ):
14- # For Wagtail 3.0 we use get_form_options
15- # So we can mix them to provide supports to Wagtail 2,3
168 opts = super ().get_form_options ()
17- opts ["widgets" ] = self .widget_overrides ()
9+ opts ["widgets" ] = {
10+ self .field_name : ColorInputWidget (),
11+ }
1812 return opts
1913
2014
2115class PolyfillColorPanel (FieldPanel ):
22- def widget_overrides (self ):
23- return {
24- self .field_name : PolyfillColorInputWidget (),
25- }
26-
2716 def get_form_options (self ):
2817 opts = super ().get_form_options ()
29- opts ["widgets" ] = self .widget_overrides ()
18+ opts ["widgets" ] = {
19+ self .field_name : PolyfillColorInputWidget (),
20+ }
3021 return opts
You can’t perform that action at this time.
0 commit comments