I came across a solution for this:

def user_subdomain(request):
    if request.META['HTTP_HOST'] == settings.NETWORK_DOMAIN:
        return {
            'user': None,
        }
    else:
        username = request.META['HTTP_HOST'].split('.')[0]
        sub_user = User.objects.get(username=username)
        return {
            'user': user,
        }


Den måndag 18 juli 2016 kl. 12:55:50 UTC+2 skrev zruu:
>
> For some reason I do not know why, when I write this context processor I 
> can't go to /accounts/update/ anymore. It displays a 404.
>
> def user_subdomain(request):
>     from django.shortcuts import get_object_or_404
>     username = request.META['HTTP_HOST'].split('.')[0]
>     user = get_object_or_404(User, username=username)
>     return {
>         'user': user,
>     }
>
> Everything else works just fine, and I can get to the login page etc.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to