R. Gorman ha scritto:
> On Sep 16, 11:32 am, Mirto Silvio Busico <[EMAIL PROTECTED]> wrote:
>
>
>> DJMSB.VIEWS----------------------------------------------------------------------------------
>>
>> from django.shortcuts import render_to_response
>> from django.contrib.auth.decorators import login_required
>> from django.contrib import auth
>>
>> @login_required
>> def indice(request):
>> return render_to_response("index.html", { 'title' : 'DJMSB'})
>>
>
> If you change your view to:
> @login_required(redirect_field_name='next')
> ...
>
> it should redirect you to the page requested by the user.
>
Well probably I didn't understand: this seems nnot to work.
I changed the file /var/django/prj/djmsb/views.py and now it is:
_______________________________________________________________________________
# Create your views here.
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.contrib import auth
@login_required(redirect_field_name='next')
def indice(request):
return render_to_response("index.html", { 'title' : 'DJMSB'})
_______________________________________________________________________________
Tried with http://localhost:8000/ (activated with "python manage.py
runserver") and I'm redirect to
http://localhost:8000/accounts/login/?next=/ that shows the login form.
It is OK
Tried (after an apache2 restart) the url: http://localhost/djmsb/ and
I'm redirect to http://localhost/accounts/login/?next=/djmsb/ that is
non existent
The correct url should be:
http://localhost/djmsb/accounts/login/?next=/djmsb/ that works but
there are two strange things:
The site name (djmsb) was lost--------------^^^^^^
The site name is correctly added in the next
parameter------------------^^^^^^
If in the URL there is no "djmsb" string apache2 don't know that tis is
a django site.
If in the next parameter there is no "/djmsb/" value after the login you
are redirected to the rooti site (http://localhost) istead of the django
site (http://localhost/djmsb/)
What I'm doing wrong?
Thanks
Mirto
>
> R.
> >
>
--
_________________________________________________________________________
Busico Mirto Silvio
Consulente ICT
cell. 333 4562651
email [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---