A `related thing`__ came up on the Django Dev list this week.
I'm not that old-school. :-) I use that `{% if user.is_authenticated
%}` all over my site and it's a pain to import and call all the stuff
you need for render_to_response over and over. So this is what I
changed all my views to this we
On 6/29/07, Kirk Strauser <[EMAIL PROTECTED]> wrote:
...
> return render_to_response('index.html',
> context_instance=RequestContext(request))
...
>
> My only concern is that it would seem that I'll need to manually build and
> pass in a RequestContext for every single view, since I want to h
On Friday 29 June 2007, Derek Hoy wrote:
> How are you producing your index page? If you look in the docs,
> you'll see the warning about needing a RequestContext- if that's not
> being used in the view that is loading the index.html into a response
> then the template won't have any user info ev
How are you producing your index page? If you look in the docs,
you'll see the warning about needing a RequestContext- if that's not
being used in the view that is loading the index.html into a response
then the template won't have any user info even if you are logged in..
Hope that makes some s
On Friday 29 June 2007, Jeremy Dunck wrote:
> What's your MIDDLEWARE_CLASSES setting look like?
I have:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddlewar
On 6/29/07, Kirk Strauser <[EMAIL PROTECTED]> wrote:
> I hate it when you feel *so close* to finding the answer but can't make that
> final little leap. :-)
Hmm.
What's your MIDDLEWARE_CLASSES setting look like?
--~--~-~--~~~---~--~~
You received this message be
On Friday 29 June 2007, Jeremy Dunck wrote:
> Yep, that doesn't make sense. Something else is going on.
>
> Is it possible that the view servicing /accounts/login is calling
> auth.login?
From urls.py (copied and pasted from
http://www.djangoproject.com/documentation/authentication/):
urlpatt
On 6/29/07, Kirk Strauser <[EMAIL PROTECTED]> wrote:
...
> ...which yields the text "Welcome, kirk. Thanks for logging in." I'm
> finding this somewhat confusing in that page_template knows my name if
> I'm viewing the login page but not the main index.html.
Yep, that doesn't make sense. Someth
Derek Hoy wrote:
> Take a look at this:
> http://www.djangoproject.com/documentation/authentication/#authentication-data-in-templates
>
> You can use this to put something in a base template that all your
> site templates can be based on.
>
> Derek
Well, here's my sitewide template that everythin
Take a look at this:
http://www.djangoproject.com/documentation/authentication/#authentication-data-in-templates
You can use this to put something in a base template that all your
site templates can be based on.
Derek
--~--~-~--~~~---~--~~
You received this messa
Do you want to show the user all your content without authentication? Why
not just use @login_required decorator to have then login when needed? Below
are the commands you need.
from django.contrib.auth.decorators import login_required
@login_required
def myfunction(request):
# do stuff
Vinc
Is there a list of variables that all templates can access? I'm
asking out of general interest, but the problem I'm trying to solve is
that I want to have a "login" or "logout" link on every page of the
site, depending on whether a visitor is currently authenticated, and I
don't want to have to p
12 matches
Mail list logo