2

I have a simple form using Pyramid and I want to use it as a new or update. I don't particularly want to have to create empty dictionary values for all the fields in my form, I just want it to ignore them without raising an exception.

<div metal:fill-slot="content">
<form method="POST" action="/studentupdate">
    <input name="id" value="${studentid}" type="hidden" />
    Name: <input type="text" name="studentname" value="${studentname}"/><br />
    Exam Score: <input type="text" name="studentexam" value="${studentexam}"/><br />
    Quiz Score: <input type="text" name="studentquiz" value="${studentquiz}"/><br />
    Homework Score: <input type="text" name="studenthomework" value="${studenthw}"/><br />
    <input type="submit" value="Save"/>
</form>
</div>

How can I do this?

Thanks.

Neil Walker
  • 6,400
  • 14
  • 57
  • 86

1 Answers1

0

You can workaround like this
${studentexam or ''}

% for i in missing_list or []
<li>${i}</li>
% endfor
Paul Yin
  • 1,753
  • 2
  • 13
  • 19