Type error field_contents_foreign_linked in django suit

80 views Asked by At

I have django 1.8 project where I'm using django-suit==0.2.25.

When I want to add a new item, I get an error:

TypeError at /admin/tours/tour/add/
unsupported operand type(s) for -: 'NoneType' and 'int'

This code is highlighted in path ...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>

Please for any hint. I tried already this: https://github.com/darklow/django-suit/issues/638 but without success.

1

There are 1 answers

0
johnashu On

You could try inserting a null value of '0' when a NoneType is returned.

for example:

value = None

if value == None:
    value = 0

sum = value - 1

if sum != 0:
    sum = 0

print(sum)

This will stop the error but I am not sure how it will affect the code..