Esempio n. 1
0
    def login(self, request, form_class=None):
        "Login form"
        if user_is_authenticated(request.user):
            return HttpResponseRedirect(
                reverse('nexus:index', current_app=self.name))

        return HttpResponseRedirect('{login}?{get}'.format(
            login=reverse('admin:login'),
            get=urllib.parse.urlencode({REDIRECT_FIELD_NAME: request.path})))
Esempio n. 2
0
File: sites.py Progetto: YPlan/nexus
    def login(self, request, form_class=None):
        "Login form"
        if request.user.is_authenticated:
            return HttpResponseRedirect(reverse('nexus:index', current_app=self.name))

        return HttpResponseRedirect(
            '{login}?{get}'.format(
                login=reverse('admin:login'),
                get=urllib.parse.urlencode({REDIRECT_FIELD_NAME: request.path}),
            ),
        )
Esempio n. 3
0
    def get_home_url(self, request):
        if self.home_url:
            if self.app_name:
                home_url_name = '%s:%s' % (self.app_name, self.home_url)
            else:
                home_url_name = self.home_url

            home_url = reverse(home_url_name, current_app=self.name)
        else:
            home_url = None

        return home_url