Transfer the random photo algorithm to django app.