File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 33
33
class ArrayWidget (MultiWidget ):
34
34
template_name = "unfold/forms/array.html"
35
35
36
- def __init__ (self , * args : Any , ** kwargs : Any ) -> None :
36
+ def __init__ (
37
+ self ,
38
+ widget_class : Optional [type [Widget ]] = None ,
39
+ * args : Any ,
40
+ ** kwargs : Any ,
41
+ ) -> None :
37
42
if "choices" in kwargs :
38
43
self .choices = kwargs ["choices" ]
39
44
45
+ if widget_class is not None :
46
+ self .widget_class = widget_class
47
+
40
48
widgets = [self .get_widget_instance ()]
41
49
super ().__init__ (widgets )
42
50
43
51
def get_widget_instance (self ) -> Any :
52
+ if hasattr (self , "widget_class" ):
53
+ return self .widget_class ()
54
+
44
55
if hasattr (self , "choices" ):
45
56
return UnfoldAdminSelectWidget (choices = self .choices )
46
57
Original file line number Diff line number Diff line change 1
1
2
- < div class ="max-w-2xl relative ">
2
+ < div class ="max-w-2xl relative w-full ">
3
3
{% if widget.prefix %}
4
4
< span class ="absolute left-3 top-0 bottom-0 flex items-center justify-center ">
5
5
{{ widget.prefix }}
You can’t perform that action at this time.
0 commit comments