[Django] #28962: Documentation of use of template tags in forms

4 views
Skip to first unread message

Django

unread,
Dec 25, 2017, 8:29:54 AM12/25/17
to django-...@googlegroups.com
#28962: Documentation of use of template tags in forms
-------------------------------------+-------------------------------------
Reporter: Malik A. | Owner: nobody
Rumi |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 2.0
Documentation | Keywords: forms,
Severity: Normal | templatetags, urls
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
I'm wondering why both https://docs.djangoproject.com/en/1.11/topics
/class-based-views/mixins/#using-formmixin-with-detailview and
https://docs.djangoproject.com/en/2.0/topics/auth/default/ have no
explicit discussion of the use of template tags, and the latter page only
has a couple of one line examples? Other than that, you seem to be
recommending the use of hard coded urls, which I thought was strange, but
maybe has a purpose I am not aware of? Thx.

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

Django

unread,
Dec 26, 2017, 3:14:03 PM12/26/17
to django-...@googlegroups.com
#28962: Documentation of use of template tags in forms
-------------------------------------+-------------------------------------
Reporter: Malik A. Rumi | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: forms, | Triage Stage:
templatetags, urls | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

I guess you're referring to an example like:
{{{
@permission_required('polls.can_vote', login_url='/loginpage/')
}}}
which instead could be something like (untested):
{{{
@permission_required('polls.can_vote', login_url=reverse_lazy('some-page-
nam'`))
}}}
(I think you mixed up terminology in calling `reverse()` and
`reverse_lazy()` "template tags"... probably you were thinking of the {%
url %} tag.)

I don't know if we should try to avoid hardcoding URLs in all examples. It
may make things a bit less readable. Nor am I sure if it's beneficial to
mention everywhere a URL is accepted that you can also use `reverse()` to
avoid hardcoding one. The topic of hardcoding URLs is discussed in the
tutorial, so hopefully a Django user would remember that and not need a
constant reminder.

--
Ticket URL: <https://code.djangoproject.com/ticket/28962#comment:1>

Django

unread,
Dec 28, 2017, 11:40:41 AM12/28/17
to django-...@googlegroups.com
#28962: Documentation of use of template tags in forms
-------------------------------------+-------------------------------------
Reporter: Malik A. Rumi | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: 2.0
Severity: Normal | Resolution: needsinfo

Keywords: forms, | Triage Stage:
templatetags, urls | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/28962#comment:2>

Reply all
Reply to author
Forward
0 new messages