对这一个的任何帮助都会很棒.我正在使用python 2.7和django 1.2这是我的代码:
for save in saved: #list to iterate
try:
sect = obj.get(name=save) #obj is a RelatedManager
except: #if two sections have the same name
sect = obj.filter(name=save)
else:
#finish my code
Run Code Online (Sandbox Code Playgroud)
MultipleObjectsReturned每次碰到get()声明时我都会收到错误.我不是python的专家所以我想我错过了一些简单的东西.