'AnonymousUser' object is not iterable
<pre><code>if not request.user.is_authenticated:
    return None

try:
    return ClientProfile.objects.get(user=request.user)
except ClientProfile.DoesNotExist:
    return None
</code></pre>

<p>This code should return None, if I'm not logged in and trying to call it. But as I see from stacktrace, it crashes with error "'AnonymousUser' object is not iterable" on this line:</p>

<pre><code>return ClientProfile.objects.get(user=request.user)
</code></pre>

<p>I'm browsing the following page in private mode, so I'm 100% not authenticated. </p>

<p>How to fix this issue?</p>