While my code could run as expected, I cannot find when and where the
field values in "form" are set before it's called in line 4~6 of the
form.html as below. What I'm particularly interested in was the
content_type field.
Part of my code looks like this:
detail.html:
21 {% load comments %}
22 {% get_comment_count for topic as comment_count %}
23 <p>{{ comment_count }} comments have been posted. </p>
24
25 {% render_comment_list for topic %}
26
27 {% render_comment_form for topic %}
form.html under templates/comments/
1 {% load comments i18n %}
2 <form action="{% comment_form_target %}" method="post">{%
csrf_token %}
3 {% if next %}<input type="hidden" name="next"
value="{{ next }}" />{% endi f %}
4 {% for field in form %}
5 {% if field.is_hidden %}
6 {{ field }}
...
The source code of form.html when opened in a browser:
...
<form action="/comments/post/" method="post"><div
style='display:none'><input type='hidden' name='csrfmiddlewaretoken'
value='7bc056d8f14034c257c49aa0b38763ce' /></div>
<input type="hidden" name="content_type" value="topics.topic"
id="id_content_type" />
<input type="hidden" name="object_pk" value="1"
id="id_object_pk" />
<input type="hidden" name="timestamp" value="1291103625"
id="id_timestamp" />
<input type="hidden" name="security_hash"
value="a4080f739cd016f4eaa2ed2bfb4b9f5e6c0ed313"
id="id_security_hash" />
...
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment