Fix possible none

This commit is contained in:
PCoder 2022-03-05 01:32:47 +05:30
parent da8fba3497
commit 5b7e4eed3e

View file

@ -183,7 +183,7 @@ def get_paginated(query_set, page, per_page):
for r in p.fieldspeople_set.all(): for r in p.fieldspeople_set.all():
filters['field'].append(r.field.name) filters['field'].append(r.field.name)
for r in p.taxapeople_set.all(): for r in p.taxapeople_set.all():
if r.taxon and r.taxon.name: if r and r.taxon and r.taxon.name:
filters['taxon'].append(r.taxon.name) filters['taxon'].append(r.taxon.name)
else: else:
print("r.taxon.name is None %s %s" % (r.range_id, r.taxon)) print("r.taxon.name is None %s %s" % (r.range_id, r.taxon))