#24871: Textarea widget has redundant \r\n when writing XHTML
----------------------------------+------------------------------------
     Reporter:  tompecina         |                    Owner:  nobody
         Type:  Bug               |                   Status:  new
    Component:  Forms             |                  Version:  1.8
     Severity:  Normal            |               Resolution:
     Keywords:  textarea, widget  |             Triage Stage:  Accepted
    Has patch:  0                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+------------------------------------

Comment (by tompecina):

 The problem is not with having to subclass the widget (I never use non-
 custom widgets in my projects anyway) but that there is currently no
 elegant way of doing it; as a tentative and provisional fix, I'm
 overriding the {{{render}}} function with taking whatever the superclass'
 {{{render}}} returns and replacing the newline after the first ">" with an
 empty string, like this:
 {{{
     def render(self, *args, **kwargs):
         return mark_safe(super(taw, self).render(*args,
 **kwargs).replace('>\r\n', '>', 1))
 }}}
 Having a widget parameter would definitely be nice.

--
Ticket URL: <https://code.djangoproject.com/ticket/24871#comment:10>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.4b5d1af987a0fd8ca8b0c7b49b89b221%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to