I've just stumbled upon the same problem in my code. I have no clue on why it happened either. Did you ever get any progress on investigating this issue?
Regards, Joao On Oct 7, 12:31 pm, Torsten Bronger <bron...@physik.rwth-aachen.de> wrote: > Hall chen! > > I examine a traceback that ends with > > ... > > File "/usr/lib/python2.6/dist-packages/django/db/models/query.py", line > 351, > in get > % (self.model._meta.object_name, num, kwargs)) > > TypeError: 'DoesNotExist'objectisnotcallable > > The error-triggering source code in query.py says > > def get(self, *args, **kwargs): > """ > Performs the query and returns a singleobjectmatching the given > keyword arguments. > """ > clone = self.filter(*args, **kwargs) > if self.query.can_filter(): > clone = clone.order_by() > num = len(clone) > if num == 1: > return clone._result_cache[0] > ifnotnum: > raise self.model.DoesNotExist("%s matching query doesnotexist." > % self.model._meta.object_name) > raise self.model.MultipleObjectsReturned("get() returned more than > one %s -- it returned %s! Lookup parameters were %s" > % (self.model._meta.object_name, num, kwargs)) > > The last line triggers the error. This is strange for two reasons: > First,DoesNotExistshould becallablefor all models. And > secondly, there is noDoesNotExistin the last line but a > MultipleObjectsReturned. > > My source code that is responsible for the error is: > > try: > sample = self.samples.get() # Here, the TypeError occurs > except (Sample.DoesNotExist, Sample.MultipleObjectsReturned): > pass > > "self" is a model instance. "samples" is a M2M field of "self" to > the class "Sample". In my case, ther are 20 samples connected with > the "self" instances, so raising a MultipleObjectsReturned would be > correct. > > Does anybody have an idea what is going on here? How should I > proceed with debugging? > > Tsch , > Torsten. > > -- > Torsten Bronger Jabber ID: torsten.bron...@jabber.rwth-aachen.de > orhttp://bronger-jmp.appspot.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.