Django TEMPLATE_CONTEXT_PROCESSORS Not Working

One thing that django’s docs fail to clearly state is that to use Template Context Processors, you need to use a RequestContext when rendering your template. If you don’t, you’ll wonder why your context processing function is not getting called.

This won’t work:

from django.shortcuts import render_to_response

def myview(request):
    return render_to_response("index.html", {})

But this will:

from django.shortcuts import render_to_response
from django.template import RequestContext

def myview(request):
    return render_to_response("index.html", {}, context_instance=RequestContext(request))
Posted at 6pm on 01/08/15 | Comments Off | Filed Under: django, python read on

Fix for “Error RC2144 : PRIMARY LANGUAGE ID not a number”

This happens when Visual Studio 2010 breaks itself. It rewrites your Resources.rc and then complains that you fucked it up. Thanks. Adding #include <windows.h> seems to fix it…for now.

Resources.rc

// Microsoft Visual C++ generated resource script.
//
#include <windows.h>
#include "resource.h"
etc...
Posted at 2pm on 04/06/12 | 5 comments | Filed Under: c++, microsoft, visual studio read on

About

A list of things I can’t remember how to do.

Categories