Fixed #22064 -- Add check for related_name

Validates that related_name is a valid Python id or ends with a '+' and
it's not a keyword. Without a check it passed silently leading to
unpredictable problems.

Thanks Konrad Świat for the initial work.
Merge pull request #3308 from aericson/ticket_22064

Fixed #22064 -- Add check for related_name