[web] write css_class to attrs on rendering and not on button creation
authorLaura Médioni <laura.medioni@logilab.fr>
Thu, 11 Jun 2015 16:51:51 +0200
changeset 10479 b0417cacecd9
parent 10455 ad0615d4500d
child 10480 770b58f99e66
[web] write css_class to attrs on rendering and not on button creation Because css_class attribute may be overriden by bootstrap after button creation and this modification has to be taken into account. closes #5457548
web/formwidgets.py
--- a/web/formwidgets.py	Tue May 06 10:28:23 2014 +0200
+++ b/web/formwidgets.py	Thu Jun 11 16:51:51 2015 +0200
@@ -1040,11 +1040,11 @@
         self.value = ''
         self.onclick = onclick
         self.cwaction = cwaction
-        self.attrs.setdefault('class', self.css_class)
 
     def render(self, form, field=None, renderer=None):
         label = form._cw._(self.label)
         attrs = self.attrs.copy()
+        attrs.setdefault('class', self.css_class)
         if self.cwaction:
             assert self.onclick is None
             attrs['onclick'] = "postForm('__action_%s', \'%s\', \'%s\')" % (