我在django non-rel中使用djangoappengine。
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.