Hi, thanks your your reply.

And what should be the right way of doing this?

Best Regards,



On Sun, Aug 21, 2011 at 5:00 AM, Subhranath Chunder
<subhran...@gmail.com> wrote:
> No, it's working is not a mistake by itself. Because now, the regular
> expression is extracting an absolute path, and not a relative url path.
> But, you are surely using things "the wrong way". :)
>
> On Sun, Aug 21, 2011 at 4:57 PM, Andre Lopes <lopes80an...@gmail.com> wrote:
>>
>> Hi,
>>
>> Thanks for the reply.
>>
>> I have discovered that If I use this:
>>
>> [code]
>> <p>Welcome {{ request.user.username }}. <a href="{% url
>> auth_logout_next '/directorio/' %}">Logout</a></p>
>> [/code]
>>
>> Instead of:
>>
>> [code]
>> <p>Welcome {{ request.user.username }}. <a href="{% url
>> auth_logout_next 'directorio' %}">Logout</a></p>
>> [/code]
>>
>> I got the code working as expected. The thing is that I got an URL
>> like this: http://localhost:8080/logout//directorio//
>>
>> This should be working like this, or this is just a mistake that works?
>>
>>
>> PS: Sorry my english.
>>
>> On Sat, Aug 20, 2011 at 10:35 PM, Subhranath Chunder
>> <subhran...@gmail.com> wrote:
>> >> <p>Welcome {{ request.user.username }}. <a href="{% url
>> >> auth_logout_next 'directorio' %}">Logout</a></p>
>> > This part of your code is generating a logout URL like this in your
>> > template: "/logout/directorio"
>> > Now, your urls.py has the pattern:
>> > url(r'^logout/(?P<next_page>.*)/$',
>> > 'django.contrib.auth.views.logout', name='auth_logout_next'),
>> >
>> > This makes, the variable 'next_page' assign the value after the slash
>> > 'login/' section. i.e. next_page = 'directorio'
>> > Now, the logout view is invoked and it's code gets executed. But since
>> > you
>> > provided a relative url value to this view, a http 302 is issued to the
>> > client to fetch the new url. Formed as a result of joining you current
>> > url
>> > and the relative path. i.e. '/login/directorio/directorio'. Which is
>> > basically again matching with the last url pattern. So, this whole thing
>> > keeps on going in a loop where:
>> > '/logout/directorio' is requested the first time. In response, the
>> > client is
>> > requested to fetch url,
>> > '/logout/directorio/directorio' the second time...
>> > '/logout/directorio/directorio/directorio/directorio' the third time...
>> > and so on and on in a loop.
>> > This is why you never see the expected output in the page. The actual
>> > logout
>> > is done in the first request only.
>> > So, when you refresh the page, you are basically pre-empting your
>> > browser
>> > client to break the initial loop, and manually requesting for the new
>> > fetch
>> > request.
>> > I hope I was able to clear the reason behind the outcome you were
>> > experiencing.
>> >
>> >
>> > On Sat, Aug 20, 2011 at 2:39 PM, Andre Lopes <lopes80an...@gmail.com>
>> > wrote:
>> >>
>> >> I am new to Django, and I am trying to put the logout to work...
>> >>
>> >> I have installed the an App called, Django-Registration.
>> >>
>> >> My problem is that I can do the logout, but the page does not get
>> >> refreshed, I must to press F5 after the logout to see the page for not
>> >> logged users.
>> >>
>> >> What I have done is the following:
>> >>
>> >> urls.py, added to urlpatterns:
>> >> [code]
>> >> url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page':
>> >> '/'}, name='auth_logout'),
>> >> url(r'^logout/(?P<next_page>.*)/$',
>> >> 'django.contrib.auth.views.logout', name='auth_logout_next'),
>> >> [/code]
>> >>
>> >> In the template I have this code:
>> >> [code]
>> >> {% if request.user.is_authenticated %}
>> >>    <p>Welcome {{ request.user.username }}. <a href="{% url
>> >> auth_logout_next 'directorio' %}">Logout</a></p>
>> >> {% else %}
>> >>    <p>Welcome. Please <a href="/accounts/login/">login</a> or <a
>> >> href="/accounts/register/">register</a></p>
>> >> {% endif %}
>> >> [/code]
>> >>
>> >> When I click Logout I dont see this in the screen:
>> >> [code]
>> >> <p>Welcome. Please <a href="/accounts/login/">login</a> or <a
>> >> href="/accounts/register/">register</a></p>
>> >> [/code]
>> >>
>> >> I only see this text if I use F5 to refresh the page.
>> >>
>> >> What I am missing here?
>> >>
>> >> Please give me a clue.
>> >>
>> >> Best Regards,
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Django users" group.
>> >> To post to this group, send email to django-users@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> django-users+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/django-users?hl=en.
>> >>
>> >
>> >
>> >
>> > --
>> > Thanks,
>> > Subhranath Chunder.
>> > www.subhranath.com
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Thanks,
> Subhranath Chunder.
> www.subhranath.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to