[英]Type error field_contents_foreign_linked in django suit
我有django 1.8項目,正在使用django-suit == 0.2.25。
當我想添加新項目時,出現錯誤:
TypeError at /admin/tours/tour/add/
unsupported operand type(s) for -: 'NoneType' and 'int'
這段代碼在...venv/lib/python3.5/site-packages/suit/templates/admin/includes/fieldset.html, error at line 44
路徑中突出顯示...venv/lib/python3.5/site-packages/suit/templates/admin/includes/fieldset.html, error at line 44
:
<span class="readonly">
{{ field|field_contents_foreign_linked }}
</span>
請提供任何提示。 我已經嘗試過了: https : //github.com/darklow/django-suit/issues/638但沒有成功。
您可以嘗試在返回NoneType時插入一個空值'0'。
例如:
value = None
if value == None:
value = 0
sum = value - 1
if sum != 0:
sum = 0
print(sum)
這將停止錯誤,但我不確定它將如何影響代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.