Fix compatibility issue with older Django versions