def add_cou(request): names = ['大学英语', '大学语文', '高数', '模电', 'VHDL'] for name in names: cou = Course() cou.c_name = name cou.save() return HttpResponse('添加课程成功')
def add_course(): cou = Course() cou.c_name = '大学英语' db.session.add(cou) db.session.commit() return '创建成功'
def add_cou(): cous = ['线代', '高数', '概论', '大学物理', '大学英语'] for cou in cous: c = Course() c.c_name = cou c.save() return '创建课程成功'
def add_course(request): c_names = ['大学英语', '商务英语', '线代', '高数'] for name in c_names: c = Course() c.c_name = name c.save() return HttpResponse('创建课程成功')
def add_cou(request): cous = ['线代', '高数', '物理', '英语'] for c in cous: cou = Course() cou.c_name = c cou.save() return HttpResponse('创建课程成功')
def add_course(): if request.method == 'GET': courses = ['线代', '高数', '大学物理', '计算机', '英语'] for course in courses: c = Course() c.c_name = course db.session.add(c) db.session.commit() return '创建课程成功'
def add_course(): """ 添加课程 :return: """ course_list = ['语文', '数学', '英语', '音乐', '运筹学', '建筑风格', '剪力与应力'] for i in course_list: courses = Course() courses.c_name = i db.session.add(courses) db.session.commit() return '创建成功'
def add_course(): if request.method == 'GET': courses = ['语文', '数学', '英语', '物理', '化学', '生物', '普通地质学', '构造地质学'] # for course in courses: # c = Course() # c.c_name = course # db.session.add(c) # db.session.commit() c = [] for course in courses: cou = Course() cou.c_name = course c.append(cou) db.session.add_all(c) db.session.commit() return '创建课程成功'
def add_crouse(): """ 添加课程 """ course_dict = { '线性代数': '超级简单', 'VHDL': '', 'PYTHON': '人生苦短,我用PYTHON', 'JAVA': '写起来麻烦', '马克思': '', '高数': '学不懂', '大学物理': '懂不起' } for k in course_dict: course = Course() course.c_name = k course.c_desc = course_dict[k] db.session.add(course) db.session.commit() return '创建课程成功'