'with' expected at least one variable assignment
Request Method: | GET |
---|---|
Request URL: | http://127.0.0.1:8000/ |
Django Version: | 2.0.2 |
Exception Type: | TemplateSyntaxError |
Exception Value: | 'with' expected at least one variable assignment |
在django模板中使用with标签报"expected at least one variable assignment的错误",原因是record和=,=和product之间不能有空格,否则就会报这个错误。正确写法如下所示:
{% with record=product.get_last_record %}{%endwith%}