#17254: ModelBackend should have a get_anonymous_user method ------------------------------------+-------------------------------------- Reporter: riccardodivirgilio | Owner: nobody Type: Bug | Status: closed Component: contrib.auth | Version: Severity: Normal | Resolution: needsinfo Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ------------------------------------+--------------------------------------
Comment (by riccardodivirgilio): sorry for my english, i'm italian and i just woke up... yesterday i was drunk so sorry.... but read the backends.py for me it's much more customizable in the way i wrote... the methods inside the backend use self.user_class.objects.get to get an user, instead of doing User.objects.get i added a get_anonymous_user to get a fresh instance of AnonymousUser, this method must be used by the middleware for me doing an import such "from django.contrib.auth.models import AnonymousUser" and then call directly AnonymousUser(), it'wrong, because if you do something like this, i have to rewrite more code to make login/logout and middleware work the way i need. the way i wrote the backend, to subclass it you simply need to hook your user model and your anonimoususer class, and django will do the dirty of work of login, logout, password change and so on. bye bye, my django friends! -- Ticket URL: <https://code.djangoproject.com/ticket/17254#comment:4> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.