Skip to content

Support Django custom user models in devserver.modules.request.SessionInfoModule #73

Open

Description

@jesselathamdev

Hey there,

Found an error which is thrown due to the assumption that request.user.username will always exist in devserver.modules.request.SessionInfoModule. In my custom user model configuration I've replaced 'username' with 'email'.


Traceback (most recent call last):
File "/Users/jesselatham/Envs/portfolio/src/django/django/contrib/staticfiles/handlers.py", line 72, in call
return self.application(environ, start_response)
File "/Users/jesselatham/Envs/portfolio/src/django/django/core/handlers/wsgi.py", line 255, in call
response = self.get_response(request)
File "/Users/jesselatham/Envs/portfolio/src/django/django/core/handlers/base.py", line 191, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/Users/jesselatham/Envs/portfolio/src/django/django/core/handlers/base.py", line 217, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/Users/jesselatham/Envs/portfolio/src/django/django/core/handlers/base.py", line 187, in get_response
response = middleware_method(request, response)
File "/Users/jesselatham/Envs/portfolio/src/django-devserver/devserver/middleware.py", line 47, in process_response
mod.process_response(request, response)
File "/Users/jesselatham/Envs/portfolio/src/django-devserver/devserver/modules/request.py", line 23, in process_response
user = '%s (id:%s)' % (request.user.username, request.user.pk)
File "/Users/jesselatham/Envs/portfolio/src/django/django/utils/functional.py", line 202, in inner
return func(self._wrapped, *args)
AttributeError: 'User' object has no attribute 'username'


I've able to successfully patch this line on my end by changing 'username' to 'email' to keep it working.

For what it's work this is the dev server that I've been looking for!

Thanks,
Jess

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions