Hello people,
How can I access the value of a form field in the template ? I'm
having
two different use cases :
- display a field value as simple text (the field is not meant to be
edited
by the user, therefore i don't want to use a input field)
- use the field value for generating a link
( something like this: <a href="{% url cmds.views.details
form.cmd_id.value %}">Details</a> )
It would have been nice to have an attribute
{{form.field_name.value}}
which would return the value instead of a widget.Unfortunately there
seems
to be no such attribute available.
I have looked at the Field attributes and also at the list of
available widgets,
but none seems to do what I need : simply display the value as raw
text
instead of generating input field / textarea / etc. I guess that my
use cases
are frequent enough, so there must be some simple way to do it ...
(if it makes any difference: i am actually trying to use a forms set,
and
in each of the forms i want to create "details" and "delete" links
using
the id of the current record).
Thanks in advance for any tips,
Adrian
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.