liveBook · Manning

AnonymousUser

As explained in Django in Action

AnonymousUser is Django's user object representing a request made by someone who is not authenticated.

AnonymousUser is Django’s request-level user object for someone who is not authenticated. Its is_authenticated attribute is always False, and it has no related UserProfile. section 7.4.3

Treat AnonymousUser as a normal request possibility, not as a user with a missing password:

  • Avoid accessing request.user.userprofile without checking whether the profile exists. section 7.4.3
  • Use @login_required when venue information should be restricted. section 7.4.3

How Django in Action covers it

How deep it goes
Explains the request object, is_authenticated, missing UserProfile, and a defensive view implementation.
Examples
Uses the venues() view and venue-list template to hide editing controls and avoid profile lookups for anonymous visitors.
What it assumes
Assumes familiarity with Django requests, authenticated users, and related UserProfile objects.
What you can do after
Diagnose anonymous-request crashes and implement public views that safely handle absent user profiles.
How it connects
Connects request objects, authentication, UserProfile, login_required, and Django templates.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Django in Action. The section links point to the parts of the book it draws on.