#20313: AnonymousUser should follow custom User implementation -------------------------------------+------------------------------------- Reporter: thinkingpotato@… | Owner: | thinkingpotato Type: New feature | Status: assigned Component: contrib.auth | Version: Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by skorokithakis): I've hit this problem as well. I'm trying to add a property to each user and reference it in the template, with a default for an anonymous user, and it's much, much harder since I can't add the same method to the anonymous user as the authenticated user. However, I'm not really sure why Django even has two classes for this. Wouldn't an anonymous user be a regular `User` object for which `is_anonymous()` would return `True`? `is_anonymous()` could decide this any way it liked (lack of `id`, lack of some specific property, or even just `_anonymous` set to True). That way, all methods would distinguish between authenticated and unauthenticated users through the standard interface, i.e. the `is_anonymous()` method (and its converse, `is_authenticated()`). Does that make sense? -- Ticket URL: <https://code.djangoproject.com/ticket/20313#comment:9> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/082.45ce2a86e0464a595d384bb93f89d1d5%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.