:relate_courses
Exception Location:
C:\Users\Edward\PycharmProjects\MxOnline\apps\courses\views.py in get, line 60
Python Executable:
C:\Users\Edward\Envs\mxonline\Scripts\python.exe
Python Version:
2.7.11
Python Path:
['C:\\Users\\Edward\\PycharmProjects\\MxOnline\\extra_apps',
'C:\\Users\\Edward\\PycharmProjects\\MxOnline\\apps',
'C:\\Users\\Edward\\PycharmProjects\\MxOnline',
'C:\\Users\\Edward\\PycharmProjects\\MxOnline\\extra_apps',
'C:\\Users\\Edward\\PycharmProjects\\MxOnline\\apps',
'C:\\Users\\Edward\\PycharmProjects\\MxOnline',
'C:\\WINDOWS\\SYSTEM32\\python27.zip',
'C:\\Users\\Edward\\Envs\\mxonline\\DLLs',
'C:\\Users\\Edward\\Envs\\mxonline\\lib',
'C:\\Users\\Edward\\Envs\\mxonline\\lib\\plat-win',
'C:\\Users\\Edward\\Envs\\mxonline\\lib\\lib-tk',
'C:\\Users\\Edward\\Envs\\mxonline\\Scripts',
'd:\\program files\\python27\\Lib',
'd:\\program files\\python27\\DLLs',
'd:\\program files\\python27\\Lib\\lib-tk',
'C:\\Users\\Edward\\Envs\\mxonline',
'C:\\Users\\Edward\\Envs\\mxonline\\lib\\site-packages']
Server time:
星期四, 19 一月 2017 22:46:59 +0800
因为在前端HTML页面收到返回的relate_courses内容是空,
但是在前端会将relate_courses内容循环迭代输出,即便没有值也需要relate_courses 是一个数组
HTML代码:
{% for relate_course in relate_courses %}
<a target="_blank" href="">
<img width="240" height="220" class="scrollLoading" src="{{ MEDIA_URL }}{{ relate_course.image }}"/>
<a target="_blank" href=""><h2> django实战项目</h2></a>
<span class="fl">学习时长:<i class="key">0</i></span>
{% endfor %}