python - Which file is used in import statement for 'MultipleObjectsReturne' exception -



python - Which file is used in import statement for 'MultipleObjectsReturne' exception -

i using code

except multipleobjectsreturned: homecoming httpresponse('some error')

but error

global name 'multipleobjectsreturned' not defined

you can either:

from django.core.exceptions import multipleobjectsreturned except multipleobjectsreturned e: homecoming httpresponse(e)

or:

except yourmodel.multipleobjectsreturned e: homecoming httpresponse(e)

https://docs.djangoproject.com/en/1.3/ref/exceptions/#django.core.exceptions.multipleobjectsreturned

a base of operations version of exception provided in django.core.exceptions; each model class contains subclassed version can used identify specific object type has returned multiple objects.

python exception-handling

Comments

Popular posts from this blog

ios - Fragment Shader GLSL for texture, color and texture/color -

iphone - Dismissing a UIAlertView -

java - Does anyone know the name of this "LookAndFeel"? -