Manager isn't accessible via model instances

前端 未结 6 1323
余生分开走
余生分开走 2020-12-13 05:19

I\'m trying to get model objects instance in another one and I raise this error :

 Manager isn\'t accessible via topic instance

Here\'s my

6条回答
  •  醉梦人生
    2020-12-13 06:14

    Could also be caused by a pair of parantheses too much, e.g.

    ModelClass().objects.filter(...)
    

    instead of the correct

    ModelClass.objects.filter(...)
    

    Happens to me sometimes when bpython (or an IDE) automatically adds parantheses.

    The result, of course, is the same - you have an instance instead of a class.

提交回复
热议问题