Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Redirecionamento Login
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Gustavo Henrique  
View profile   Translate to Translated (View Original)
 More options Feb 9, 12:36 pm
From: Gustavo Henrique <guustavo0.henri...@gmail.com>
Date: Thu, 9 Feb 2012 09:36:14 -0800 (PST)
Local: Thurs, Feb 9 2012 12:36 pm
Subject: Redirecionamento Login
Boa tarde,
Sou novo em Django, e estou com o seguinte problema:
Depois de usuário estar logado no sistema ele consegue acessar ás
páginas de login e a de cadastro de um novo usuário, essas páginas só
poderam ser acessadas se o usuário não tiver logado, queria saber se
tem algum Decorator para fazer isso, ou mesmo alguma tag de template
que redirecione para uma outra views.

Desde já, agradeço.
att. Gustavo Henrique


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rodrigo Otávio Passos Ferreira  
View profile   Translate to Translated (View Original)
 More options Feb 9, 1:21 pm
From: Rodrigo Otávio Passos Ferreira <rodr...@gmail.com>
Date: Thu, 09 Feb 2012 16:21:41 -0200
Local: Thurs, Feb 9 2012 1:21 pm
Subject: Re: Redirecionamento Login
não sei se resolve seu problema mas esse trecho extraido da documentacao
(https://docs.djangoproject.com/en/1.1/topics/auth/) pode te ajudar

{% if user.is_authenticated %}
    <p>Welcome, {{ user.username }}. Thanks for logging in.</p>
{% else %}
    <p>Welcome, new user. Please log in.</p>
{% endif %}


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Evandro Myller  
View profile   Translate to Translated (View Original)
 More options Feb 10, 12:46 pm
From: Evandro Myller <evandromyl...@gmail.com>
Date: Fri, 10 Feb 2012 09:46:14 -0800 (PST)
Local: Fri, Feb 10 2012 12:46 pm
Subject: Re: Redirecionamento Login
Vc teria que fazer o contrário do que o decorator "login_required"
faz.
Pra simplificar, vc pode usar o seguinte, dentro das tais views:

        if request.user.is_authenticated():
                return redirect(url)

        ...

Se quiser deixar a coisa mais bonita, escreva um decorator. ;-)

On Feb 9, 3:36 pm, Gustavo Henrique <guustavo0.henri...@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gustavo Henrique  
View profile   Translate to Translated (View Original)
 More options Feb 10, 2:04 pm
From: Gustavo Henrique <guustavo0.henri...@gmail.com>
Date: Fri, 10 Feb 2012 11:04:23 -0800 (PST)
Local: Fri, Feb 10 2012 2:04 pm
Subject: Re: Redirecionamento Login
Obrigado, acabei conseguindo, escrevi um decorator que faz o contrário
do @login_required!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »