{# Page assets live INSIDE the content block (the dj-root): dj-navigate swaps only that region, so anything in extra_head/extra_scripts is missing when a visitor arrives by live navigation. Behaviour lives in static/js/site-pages.js. #}
DJE-014 Error Configuration
PresenceMixin crash without AuthenticationMiddleware
Error message
AttributeError: 'WSGIRequest' object has no attribute 'user'The PresenceMixin's track_presence() method accessed request.user without first checking if the user attribute exists. Applications that do not use AuthenticationMiddleware (e.g., public kiosks, embedded widgets) would crash when the presence feature was used.
auth bug-fixed config presence
Affected versions: <0.3.0
Solution
Recommended
Upgrade to djust >= 0.3.0
The PresenceMixin now checks for hasattr(request, 'user') before accessing request.user, gracefully handling unauthenticated contexts.
Before (problematic)
class PresenceMixin:
def track_presence(self, request):
user = request.user # Crashes without auth middleware!
self.register_presence(user.username)
After (fixed)
class PresenceMixin:
def track_presence(self, request):
if hasattr(request, "user") and request.user.is_authenticated:
self.register_presence(request.user.username)
else:
self.register_presence("anonymous")