So, if I get this correctly, it means that sometimes we don't get anything that matches the correct project, and thus project is set to None.

If that's the case, I would do the check on `if project is None` rather than this, so we also catch the case where the projectid isn't None, but the project doesn't exist?

Also, we could directly check `if project_id is None` and add an error to the form from there + exiting, that would make the code easier to read.

What do you think?