def delete(self, request): courses = request.DATA.get('courses', '') course_ids = courses.split(',') user = request.user try: for course_id in course_ids: if course_id: Follow.unfollow(user, 'course_meta.models.Course', course_id) except: transaction.rollback() raise error.Error(error.COURSES_FOLLOW_FAILED, u"课程取消关注失败") else: transaction.commit() return Response(status=status.HTTP_204_NO_CONTENT)
def delete(self, request, course_id): user = request.user Follow.unfollow(user, 'course_meta.models.Course', course_id) return Response(status=status.HTTP_204_NO_CONTENT)