1
0
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:
David Smith
2020-04-01 17:48:23 +01:00
committed by Mariusz Felisiak
parent ab903fe304
commit a350bfa6f4
4 changed files with 34 additions and 0 deletions

View File

@@ -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: