错误:
{function_clause,[{erlydtl_runtime,init_counter_stats,[undefined,undefined]},
{cb_tutorial_view_greeting_create_html,render_internal,4},
{cb_tutorial_view_greeting_create_html,render,2},
{boss_web_controller,render_view,6},
{boss_web_controller,execute_action,5},
{boss_web_controller,process_request,5},
{timer,tc,3},
{boss_web_controller,handle_request,3}]}
list.html
8 {% block body %}
9 <ul>
10 {% if greetings %}
11 {% for greeting in greetings %}
12 <li>{{greeting.id}}| {{greeting.greeting_text}}
13 {% endfor %}
14 {% else %}
15 <li>No greetings!
16 {% endif %}
17 </ul>
18 26 {% endblock %}
19 <form method='post' action="{% url action="goodbye" %}">
20 <select name="greeting_id">
21 {% for greeting in greetings %}
22 <option value="{{ greeting.id }}"> {{greeting.greeting_text}}
23 {% endfor %}
24 </select>
25 </form>
create.html
1 {% extends "greeting/list.html" %} %%继承了list.html
2 {% block title %} A new greeting! {% endblock %}
3
4 {% block body%}
5 <form method="post">
6 Enter a new greeting:
7 <textarea name="greeting_text"></textarea>
8 <input type="submit">
9 </form>
10 {% endblock %}
11
我是先写了部分list.html 又写了create.html 正常运行,
在list.html页面添加delete后,就抛出上面错误。想起来nitrogen中文件上传时遇到类似问题。
仔细看原来是create.html继承了list 所以就多了form 表单引起的改成下面代码就可以了
list.html, 对这个模板 不熟悉,继续看看
8 {% block body %}
9 <ul>
10 {% if greetings %}
11 {% for greeting in greetings %}
12 <li>{{greeting.id}}| {{greeting.greeting_text}}
13 {% endfor %}
14 {% else %}
15 <li>No greetings!
16 {% endif %}
17 </ul>
18
19 <form method='post' action="{% url action="goodbye" %}">
20 <select name="greeting_id">
21 {% for greeting in greetings %}
22 <option value="{{ greeting.id }}"> {{greeting.greeting_text}}
23 {% endfor %}
24 </select>
25 </form>
26 {% endblock %}