本文整理汇总了Python中models.Exercise.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Exercise.delete方法的具体用法?Python Exercise.delete怎么用?Python Exercise.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Exercise
的用法示例。
在下文中一共展示了Exercise.delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from models import Exercise [as 别名]
# 或者: from models.Exercise import delete [as 别名]
print_student = "Delete: " + str(Student.select().where(Student.id==sys.argv[3]).get())
student = Student.delete().where(Student.id == sys.argv[3]).execute()
print print_student
elif sys.argv[2] == 'batch':
if Batch.select().where(Batch.id==sys.argv[3]).count() == 0:
print "Nothing to delete"
else:
print_batch = "Delete: " + str(Batch.select().where(Batch.id==sys.argv[3]).get())
batch = Batch.delete().where(Batch.id == sys.argv[3]).execute()
print print_batch
elif sys.argv[2] == 'exercise':
if Exercise.select().where(Exercise.id==sys.argv[3]).count() == 0:
print "Nothing to delete"
else:
print_exercise = "Delete: " + str(Exercise.select().where(Exercise.id==sys.argv[3]).get())
exercise = Exercise.delete().where(Exercise.id == sys.argv[3]).execute()
print print_exercise
elif sys.argv[1] == 'print_batch_by_school':
if School.select().where(School.id==sys.argv[2]).count() == 0:
print "School not found"
else:
school = School.select().where(School.id==sys.argv[2]).get()
for batch in school.batches:
print batch
elif sys.argv[1] == 'print_student_by_batch':
if Batch.select().where(Batch.id==sys.argv[2]).count() == 0:
print "Batch not found"
else:
batch = Batch.select().where(Batch.id==sys.argv[2]).get()
for student in batch.students:
print student