วิธีค้นหาการย้อนกลับหลายรายการใน django

ฉันมีโปรไฟล์โมเดล (โปรไฟล์ผู้ใช้) และมีความสัมพันธ์มากมายกับการตั้งชื่อตนเองดังต่อไปนี้ สิ่งนี้จะจัดการระบบผู้ติดตาม / ผู้ติดตามเหมือนใน Twitter

class Profile(models.Model):
    followings = models.ManyToManyField('self', blank = True, related_name = 'followers')

ฉันสามารถรับสิ่งต่อไปนี้เพียงรับสิ่งต่อไปนี้ของผู้ใช้ แต่จะสอบถามผู้ติดตามของผู้ใช้โดยใช้แบบสอบถามรุ่น django ได้อย่างไร


person Bigair    schedule 06.04.2021    source แหล่งที่มา
comment
ฉันไม่เคยสามารถเข้าใจหลายสาขาได้ ขอโทษ.   -  person Peter Nielsen    schedule 07.04.2021
comment
@Bigair ฉันอยากจะแนะนำให้คุณใช้ปลั๊กอินนี้แทน github.com/revsys/django-friendship   -  person binpy    schedule 07.04.2021
comment
เพียงใช้ชื่อที่เกี่ยวข้อง followers เช่น สมมติว่าคุณมี p = Profile.objects.last() จากนั้น p.followers.all() จะส่งกลับชุดแบบสอบถามของวัตถุที่เกี่ยวข้องทั้งหมดไปยังวัตถุ p   -  person Ersain    schedule 07.04.2021
comment
ฉันได้รับวัตถุ 'โปรไฟล์' ไม่มีข้อผิดพลาด 'ผู้ติดตาม'   -  person Bigair    schedule 07.04.2021
comment
ตรวจสอบบทความต่อไปนี้: stackoverflow.com/questions/45847930/ ได้อย่างไร   -  person Zhivko Zaikov    schedule 07.04.2021