#33437: Add possibility to render fields individually using as_p, a_table and
as_ul
--------------------------------------------+------------------------
Reporter: Christophe Henry | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+------------------------
Currently, to render a form, there is a choice between rendering the form
entirely with:
{{{#!xml
<form action="/your-name/" method="post">
{% csrf_token %}
{{ form }}
<input type="submit" value="Submit">
</form>
}}}
and the more cumberstone solution of
[https://docs.djangoproject.com/en/4.0/topics/forms/#rendering-fields-
manually Rendering fields manually] if you need more flexibility — for
instance if you need to fieldsets like proposed in #6630:
{{{#!xml
<form action="/your-name/" method="post">
{% csrf_token %}
{{ form }}
<div class="fieldWrapper">
{{ form.subject.errors }}
{{ form.subject.label_tag }}
{{ form.subject }}
</div>
<input type="submit" value="Submit">
</form>
}}}
What I propose is a tradeoff where field can be rendered individually
using this simple syntax:
{{{#!xml
<form action="/your-name/" method="post">
{% csrf_token %}
{{ form }}
{{ form.subject.as_p }}
<input type="submit" value="Submit">
</form>
}}}
I opened [https://github.com/django/django/pull/15313 a proposition PR to
solve this feature request].
--
Ticket URL: <https://code.djangoproject.com/ticket/33437>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/058.aca28a9987511f48370dace6cf096b30%40djangoproject.com.