Opened 6 years ago

Last modified 12 months ago

#16922 new New feature

Add a template-based form rendering system

Reported by: Carl Meyer Owned by: nobody
Component: Forms Version: master
Severity: Normal Keywords: form-rendering
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

This was accepted as a GSoC project for 2011, and the work was done by Gregor Müllegger. There were extensive discussions on the django-developers mailing list about the API.

This ticket is to track the remaining work to get this template-based form rendering API into trunk. The most recent code is at https://github.com/carljm/django/compare/master...soc2011%2Fform-rendering - that branch also contains code for #15667 and #16921.

I expect that of those three tickets, #16921 can be merged first, then #15667, and this one last.

The primary issue that still needs to be resolved on this ticket, as well as #15667, is performance. https://github.com/carljm/formrenderbench can help with setting up benchmarks.

Change History (4)

comment:1 Changed 6 years ago by Carl Meyer

Has patch: set
Patch needs improvement: set

comment:2 Changed 4 years ago by Tim Graham

Carl, it looks like the branch linked above doesn't exist anymore? Do we need to start from scratch on this?

comment:3 Changed 4 years ago by Carl Meyer

Hi Tim, a few thoughts:

  1. The code that was in that GSoC branch was eventually merged into django-floppyforms and has seen updates there since, so I think it would be best to approach this in terms of a new Django branch copying/merging the desired code from floppyforms.
  1. I think that #15667 (rendering widgets via templates) alone addresses 90+% of the issues people have with customizing markup in Django forms. I think that ticket is much higher priority than this one, presuming the performance issues can be addressed, or the performance cost is deemed acceptable.
  1. Once we have #15667, there are two additional steps that could be taken to resolve this ticket: either a) a straightforward port of the existing .as_ul() and .as_p() methods to render via an overridable template instead of by constructing HTML in Python, or b) a full integration of the extensively customizable form-layouts system that Gregor built for GSoC. To be honest, I am not sure the latter needs to be in Django, I think it works just fine as a third-party add-on (at least until/unless that third-party add-on proves itself as a de facto necessity a la South, which I don't think it has done yet). So I would be in favor of limiting the scope of this ticket to (a), and only even worrying about that once #15667 is fixed.

comment:4 Changed 12 months ago by Asif Saifuddin Auvi

As template based widget rendering is now supported, what need to be done to complete this ticket? adjust code from floppy forms?

Note: See TracTickets for help on using tickets.
Back to Top