django port of our PMT