@@ -285,12 +285,18 @@ class SBAdminChoiceSearchableWidget(SBAdminBaseWidget, forms.Select):
285285 options are rendered inline as ``<option>`` tags — no API fetch, no
286286 pagination. The native ``<select>`` submits as a single value, so a plain
287287 ``ChoiceField`` is enough on the backend.
288+
289+ ``full_width`` is a class attribute so subclasses can flip the default
290+ without re-declaring ``__init__`` — useful when wiring this widget as the
291+ project-wide default via ``get_form_field_widget_class``.
288292 """
289293
290294 template_name = "sb_admin/widgets/choice_search.html"
295+ full_width = False
291296
292- def __init__ (self , form_field = None , attrs = None , choices = (), full_width = False ):
293- self .full_width = full_width
297+ def __init__ (self , form_field = None , attrs = None , choices = (), full_width = None ):
298+ if full_width is not None :
299+ self .full_width = full_width
294300 super ().__init__ (
295301 form_field , attrs = {"class" : "input" , ** (attrs or {})}, choices = choices
296302 )
@@ -309,9 +315,11 @@ class SBAdminMultipleChoiceSearchableWidget(SBAdminBaseWidget, forms.SelectMulti
309315 """
310316
311317 template_name = "sb_admin/widgets/choice_search.html"
318+ full_width = False
312319
313- def __init__ (self , form_field = None , attrs = None , choices = (), full_width = False ):
314- self .full_width = full_width
320+ def __init__ (self , form_field = None , attrs = None , choices = (), full_width = None ):
321+ if full_width is not None :
322+ self .full_width = full_width
315323 super ().__init__ (
316324 form_field , attrs = {"class" : "input" , ** (attrs or {})}, choices = choices
317325 )
0 commit comments