Please use the "else:" the try-block should only contain the line, that can raise the exception. For example:
```python
try:
  candidature = self.objects.get(....)
except AssignmentCandidate.DoesNotExist:
  ....
else:
  candidature.sort_order = sort_order
  ....
```