我正在将 djangoappengine 与 django non-rel 一起使用。
class Subject(TimeStampedModel):
class_room = models.ForeignKey( ClassRoom, related_name='class_subject')
subject = models.CharField( max_length=255)
tutor = models.ForeignKey( UserProfile, related_name='tutor')
def __unicode__(self):
return self.subject
def quick_delete_subject(request, classroom_id, subject_id):
if request.method == 'GET':
classroom = ClassRoom.objects.get(pk=classroom_id)
school = classroom.school
school_id = school.pk
try:
old_subject = Subject.objects.get(pk=subject_id)
old_subject.delete()
except:
raise
return HttpResponse('Deleted')
但是,当我尝试在视图中删除主题对象时,会出现此错误。奇怪的是有时对象被删除而没有任何错误。
Django Version: 1.5.5
Exception Type: DatabaseError
Exception Value: MultiQuery does not support keys_only.