TypeError: 'RelatedManager' object is not iterable

后端 未结 2 1447
清歌不尽
清歌不尽 2021-01-31 13:05

Django

I have next models:

class Group(models.Model):
    name = models.CharField(max_length=100)
    parent_group = models.ManyToManyField(\"self\", bla         


        
相关标签:
2条回答
  • 2021-01-31 13:34

    Try this:

    block in group.block_set.all()
    
    0 讨论(0)
  • 2021-01-31 13:35

    Use it like a Manager. If you want all the objects then call the all() method.

    0 讨论(0)
提交回复
热议问题