I was wondering if there was a way to redirect users after login to
the page they where looking at before they logged in.
So if they where on "/blog/" when they logged in they could be
redirected back and if they where on "/about_us/" they could be
redirected to "/about_us/"?
I'd appreciate any
The included login view (django.contrib.auth.views.login) takes an
optional "next" argument for this:
http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.login
Hope that helps.
-Justin
On Jul 31, 9:15 am, When ideas fail wrote:
> I was wondering if there was a way to red
You can access the page that they were previously on using
HttpRequest.META['HTTP_REFERER']. You'll probably need to persist it
in a session so you still have access to it after they submit their
login credentials (otherwise HTTP_REFERER would be the login page).
I'm not sure if HTTP_REFERER can
Is there a way to ask a page to redirect somewhere after a certain
action is completed? Specifically, after a user has logged in?
I have a sub-site running at /orgs/keyclub. When users click "Login"
from the sub-site, they are directed to the main site's login page (to
prevent code duplication -
try this
from django.http import HttpResponseRedirect
... ...
def login(request):
''' some code to put here '''
return HttpResponseRedirect("index.htm")
--
Luigi Pantano
---
AICQ - Associazione Italiana Cultura
Luigi Pantano wrote:
>try this
>
>from django.http import HttpResponseRedirect
>
>... ...
>
>def login(request):
>''' some code to put here '''
>return HttpResponseRedirect("index.htm")
>
>
>
>
I see what you're saying, but I was thinking something more on a
selective basis. This would
Luigi Pantano wrote:
>try this
>
>from django.http import HttpResponseRedirect
>
>... ...
>
>def login(request):
>''' some code to put here '''
>return HttpResponseRedirect("index.htm")
>
>
>
>
I see what you're saying, but I was thinking something more on a
selective basis. This would
try
/accounts/login/?next=/foobar
?
On 03/07/2006, at 5:03 AM, bsdlogical wrote:
>
> Luigi Pantano wrote:
>
>> try this
>>
>> from django.http import HttpResponseRedirect
>>
>> ... ...
>>
>> def login(request):
>>''' some code to put here '''
>>return HttpResponseRedirect("index.htm")
>
(who's working on the project with Nick)
It turns out that this is easy if you use
django.contrib.auth.views.login
as your default login view and
django.contrib.auth.forms.AuthenticationForm
as the manipulator for the login form you create.
But how many people actually do this?
There's one
9 matches
Mail list logo