This needs to be `request.user.userprofile` instead of `profile`.