Hello.

There is a task to create one entry point for different groups of users in 
Django, and after successfully passing authorization, redirect to the 
required page.

There are three different routes:

Urlpatterns = [
    Url (r '^ django-admin /', include (admin.site.urls)),
    Url (r '^ custom_admin /', include ('gglobal.custom_admin.urls', 
namespace = 'custom_admin')),
    Url (r '^ admin /', include (wagtailadmin_urls, namespace = 'cms')),
]


Since I'm doing the login using allauth, I need to override the 
DefaultAccountAdapter, which is responsible for the redirect after 
authenticating.

>From allauth.account.adapter import DefaultAccountAdapter
>From django.shortcuts import redirect, resolve_url
>From django.core.urlresolvers import reverse


Class AccountAdapter (DefaultAccountAdapter):
    Def get_login_redirect_url (self, request):
        Url = super (AccountAdapter, self) .get_login_redirect_url (request)
        If request.user.has_perm ('auth.change_permission'):
            Url = reverse ('admin: index')
        Return url



But reverse () returns:

    NoReverseMatch at / accounts / login /

    Reverse for 'cms' with arguments '()' and keyword arguments '{}' not 
found. 0 pattern (s) tried: []


When trying to do the same thing with other admin boards.

What should I pass to args / kwargs to work? In django-admin, there is no 
namepace at all, but it works as it should.

Tell me how to do it right?

Surely someone has already solved a similar problem.

Thank you in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/07851f19-1166-438c-bf78-f04e9ae24ce0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to