Parsing the identifier out of the url is just supposed to be best effort, not 100% perfect. Also, I don't see the problem with the above code? If you are within 'url and identifier.startswith('http'), then you are entering data for an account type that has no use for slashes, trailing or otherwise. I'm not aware of any userid/username type accounts that allow slashes.

If you enter a completely unparseable url in a field that wants an identifier, you'll end up running into validate_username_not_url or the validator for that account type, both of which will throw a ValidationError anyway.