Opened 18 years ago
Closed 17 years ago
#3568 closed (wontfix)
Add support for serializing newforms to HTML
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | newforms html xhtml | |
Cc: | treborhudson@… | Triage Stage: | Design decision needed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Currently, newforms only serializes to suit W3C's often-criticized Guidelines for serving XHTML 1.0 as text/html to buggy user agents. Its markup is not conformant with the HTML 4.01 specification, because according to HTML's SGML definition <input /> means <input>> not <input>. My patch leaves the status quo as the default, but facilitates producing conformant HTML by adding an optional argument to the serialization methods. as_p(forms.SERIALIZATION_HTML401) for example. If there's a better way to achieve the same thing, that would be good too. It would also be nice to be able to set SERIALIZATION_DEFAULT app-wide, but I'm not sure how that's done. It may be that an end_empty_element() function would be useful elsewhere in Django too.
Attachments (2)
Change History (7)
by , 18 years ago
Attachment: | htmlnewforms.diff added |
---|
by , 18 years ago
Attachment: | htmlnewforms.2.diff added |
---|
comment:1 by , 18 years ago
Component: | Core framework → django.newforms |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 18 years ago
Patch needs improvement: | set |
---|
Benjamin - you need to add your serializations
package to SVN and create a new patch.
comment:4 by , 17 years ago
Cc: | added |
---|
Yes! Please! I avoid newforms b/c it outputs XHTML. It's trivial and anal, I know, but for us who think XHTML is "broken", please include this in Django!
comment:5 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
We can't possibly include all the myriad ways someone might want to represent a form (XForms, anyone?). The as_* methods are shortcuts; nothing more. I'd consider an approach using a template filter here (i.e. {{ form|to_html
}}).
A couple fixes to my patch