Added backward compatibility for django 1.4