Code

Opened 4 years ago

Closed 4 years ago

#13381 closed (invalid)

admin:login doesn't work

Reported by: alperkanat Owned by: nobody
Component: contrib.admin Version: 1.2-beta
Severity: Keywords: sites, named, url, pattern, namespace
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

it's absent in django.contrib.admin.sites.py:

    def get_urls(self):
        from django.conf.urls.defaults import patterns, url, include

        if settings.DEBUG:
            self.check_dependencies()

        def wrap(view, cacheable=False):
            def wrapper(*args, **kwargs):
                return self.admin_view(view, cacheable)(*args, **kwargs)
            return update_wrapper(wrapper, view)

        # Admin-site-wide views.
        urlpatterns = patterns('',
            url(r'^$',
                wrap(self.index),
                name='index'),
            url(r'^logout/$',
                wrap(self.logout),
                name='logout'),
            url(r'^password_change/$',
                wrap(self.password_change, cacheable=True),
                name='password_change'),
            url(r'^password_change/done/$',
                wrap(self.password_change_done, cacheable=True),
                name='password_change_done'),
            url(r'^jsi18n/$',
                wrap(self.i18n_javascript, cacheable=True),
                name='jsi18n'),
            url(r'^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$',
                'django.views.defaults.shortcut'),
            url(r'^(?P<app_label>\w+)/$',
                wrap(self.app_index),
                name='app_list')
        )

adding it works like a charm. attaching a patch..

Attachments (1)

login.patch (492 bytes) - added by alperkanat 4 years ago.
patch for adding login named url to be able to use it with namespaces

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by alperkanat

patch for adding login named url to be able to use it with namespaces

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

It's not a case of "doesn't work" - it's a case of "isn't needed". Admin doesn't require a /login url, and unless I'm mistaken, there isn't anywhere in documentation that suggests that it should be available. You just visit the url that you actually want, and the login process is handled as a decorator to that view.

Even if a login view were needed, the patch you provide doesn't work - or rather, it will log you in, but on success, it redirects you to the same login page. Again, the login mechanism for admin is different to the default auth.login process.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.