-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Try: {% if user.is_authenticated() %}

If that doesn't work, you would need to setup the
TEMPLATE_CONTEXT_PROCESSORS setting in settings.py.

http://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors

Luke
luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


When ideas fail wrote:
> Ok, thanks, i will try that. As a thought could i not have something
> like:
> 
> {% ifequal user.username "" %}
> 
> login form
> 
> {% else %}
> 
>  you are already logged in
> 
> I don't know if that would work or not though.
> 
> On 1 Aug, 01:30, Luke Seelenbinder <luke.seelenbin...@gmail.com>
> wrote:
> No it doesn't. That would be your problem, you would have to write a
> custom backend if you wanted to not show the login form to already
> logged-in visitors.
> 
> Luke
> luke.seelenbin...@gmail.com
> 
> "I [may] disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
> 
> 
> 
> When ideas fail wrote:
>>>> I'm using (r'^login/$', 'django.contrib.auth.views.login',
>>>> {'template_name': 'blogSite/login.html'}), for the view, so does that
>>>> pass a request of not?
>>>> On 1 Aug, 01:09, Luke Seelenbinder <luke.seelenbin...@gmail.com>
>>>> wrote:
>>>> Are you passing the "request" to it?
>>>> That's the only thing I can think of that would mess it up, otherwise it
>>>> looks good syntactically.
>>>> Luke
>>>> luke.seelenbin...@gmail.com
>>>> "I [may] disapprove of what you say, but I will defend to the death your
>>>> right to say it." -- Voltaire
>>>> When ideas fail wrote:
>>>>>>> Hi, i am using this template to log people in, but it seems to always
>>>>>>> return the login form no matter what i do, i can be logged in or
>>>>>>> logged out and it will still say i need to log in.
>>>>>>> Does anyone know what might be happening. Any help would be
>>>>>>> appreciated.
>>>>>>> Thanks
>>>>>>> {% extends "blogSite/index.html" %}
>>>>>>> {% block content %}
>>>>>>>    {% if not request.user.is_authenticated %}
>>>>>>>            {% if form.errors %}
>>>>>>>                            <p class="error">Sorry, that's not a valid 
>>>>>>> username or
>>>>>>> password</p>
>>>>>>>            {% endif %}
>>>>>>>                    <p> Please enter you user name and password 
>>>>>>> below:</p>
>>>>>>>                    <form action="" method="post">
>>>>>>>                                    <label 
>>>>>>> for="username">Username:</label>
>>>>>>>                                    <input type="text" name="username" 
>>>>>>> value=""
>>>>>>> id="username"><br><br>
>>>>>>>                                    <label 
>>>>>>> for="password">Password:</label>
>>>>>>>                                    <input type="password" 
>>>>>>> name="password" value=""
>>>>>>> id="password"><br><br>
>>>>>>>                            <input type="submit" value="login" />
>>>>>>>                                    <input type="hidden" name="next" 
>>>>>>> value="../login/" />
>>>>>>>                    </form>
>>>>>>>    {% else %}
>>>>>>>            <p> you are already logged in </p>
>>>>>>>    {% endif %}
>>>>>>> {% endblock %}
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpzqlIACgkQXQrGVCncjPzD9gCgne53F8UBFiwMpzD0WxfLFDd9
7K4AoIXGlYzqJNh3g+J8pBqsDFH4MaYa
=8Mku
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
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