On 12/21/06, Rob Hudson <[EMAIL PROTECTED]> wrote:
I've got a particular case that I wonder if it is worth submitting a
patch for...
I do not have an /accounts/profile/ URL and for the site I'm building
it doesn't make sense to have a profile page. But I do need
login/logout functionality and am using django.contrib.auth. I'm also
providing "Login" and "Logout" links in the navigation of the site.
When the user clicks on a URL who's view is decorated by
login_required, they get sent to the login page and the hidden "next"
form field is populated correctly. No problems here.
But, if they click on the login link directly, "next" is empty, and so
it defaults to /accounts/profile/.
You can always populate "next" yourself in your template. The
resulting url would look something like this:
<a href="/login/?next=/url/to/this/page/">Login</a>
That way, when a user directly clicks the login link, they will be
directed back to that same page after logging in. Of course, that
won't help when someone directly types the address of the login page
into their address bar.
What I'd like to do is create a patch that allows one to specify the
default redirect_to field when next is empty so I can override the
/accounts/profile/ setting.
Usage would look something like this in the urls.py:
(r'^login/$', 'django.contrib.auth.views.login', \
{'template_name': 'account/login.html', \
'default_redirect_to': '/'}),
Worthwhile?
I think so.
In the meantime, I can set up a redirect from /accounts/profile/ to /,
but this seems hackish to me.
Cheers!
Rob
>
--
----
Waylan Limberg
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django
developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---