Related objects reference

class RelatedManager

A “related manager” is a manager used in a one-to-many or many-to-many related context. This happens in two cases:

  • The “other side” of a ForeignKey relation. That is:

    from django.db import models
    
    class Reporter(models.Model):
        # ...
        pass
    
    class Article(models.Model):
        reporter = models.ForeignKey(Reporter)
    

    In the above example, the methods below will be available on the manager reporter.article_set.

  • Both sides of a 登录查看完整内容