Render_to_response no longer accepts a context instance parameter (or a “dirs” 
parameter).
https://docs.djangoproject.com/en/dev/releases/1.10/

I encourage you to read this document before performing an upgrade:
https://docs.djangoproject.com/en/dev/howto/upgrade-version/

In particular, read the release notes (as time consuming as it is) of each 
version between the two versions you are upgrading from and to.
https://docs.djangoproject.com/en/dev/releases/


From: [email protected] [mailto:[email protected]] On 
Behalf Of Drew Ferguson
Sent: Friday, November 25, 2016 5:43 PM
To: Django users
Subject: Re: user object not available in template

I just upgraded from 1.5 or something where the code worked fine

I'm not sure what has changed in 1.10 but everything is back to normal after I 
changed

def homepage(request):
    return render_to_response('xstatic_homepage.html', RequestContext(request))

to

def homepage(request):
    return render(request, 'xstatic_homepage.html')

Can someone explain this for me please?

On Saturday, 26 November 2016 00:25:24 UTC+1, James Bennett wrote:
Ah, never mind, misread the question.

Are you sure you're using a RequestContext?

On Fri, Nov 25, 2016 at 3:23 PM, James Bennett 
<[email protected]<javascript:>> wrote:
The auth context processor provides it, but not as a variable named 'user'; 
instead it's attached to the 'request' variable, so what you want is '{% if 
request.user.is_authenticated }}'.

On Fri, Nov 25, 2016 at 3:02 PM, Drew Ferguson <[email protected]<javascript:>> 
wrote:
Hi

Using Django 1.10

In my templates there is no user object to provide user.is_authenticated

Is there something I have to do to turn this on?

My settings has this

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]


MIDDLEWARE = [
    
'django.middleware.security.Se<http://django.middleware.security.Se>curityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',
]

Thanks

Drew
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected]<javascript:>.
To post to this group, send email to [email protected]<javascript:>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0392acda-3e6d-41d6-9a6f-1b2a07f9146f%40googlegroups.com<https://groups.google.com/d/msgid/django-users/0392acda-3e6d-41d6-9a6f-1b2a07f9146f%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/757507d3-bbdf-4408-9820-6f93bf069440%40googlegroups.com<https://groups.google.com/d/msgid/django-users/757507d3-bbdf-4408-9820-6f93bf069440%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/227491228cc844c99fd4aa194869f74f%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.

Reply via email to