use get_object_or_404 for device