rewrite to use django-rest-framework