replace deprecated django funcions. compatibility work