Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
411 B
13
Indexable
Never
In [15]: articles1 = categories[0].article_set.all()

In [16]: articles2 = categories[1].article_set.all()

In [17]: print(articles1)
<QuerySet [<Article: Article object (1)>]>

In [18]: print(articles2)
<QuerySet [<Article: Article object (1)>]>

In [19]: common_categoires = []

In [20]: for article in articles1:
    ...:     if article in articles2:
    ...:         print("common article ", article.title)