replaced php stuff with django's