mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #13009 -- Added BoundField.widget_type property.
This commit is contained in:
committed by
Mariusz Felisiak
parent
ab903fe304
commit
a350bfa6f4
@@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
import re
|
||||
|
||||
from django.forms.utils import flatatt, pretty_name
|
||||
from django.forms.widgets import Textarea, TextInput
|
||||
@@ -227,6 +228,10 @@ class BoundField:
|
||||
attrs['disabled'] = True
|
||||
return attrs
|
||||
|
||||
@property
|
||||
def widget_type(self):
|
||||
return re.sub(r'widget$|input$', '', self.field.widget.__class__.__name__.lower())
|
||||
|
||||
|
||||
@html_safe
|
||||
class BoundWidget:
|
||||
|
||||
Reference in New Issue
Block a user