'An ordering referencing a model with an ordering referencing a model
multiple time no circular reference should be detected (#24654).'

def test_related_ordering_duplicate_table_reference(self):

    first_author = Author.objects.create()
    second_author = Author.objects.create()
    self.a1.author = first_author
    self.a1.second_author = second_author
    self.a1.save()
    self.a2.author = second_author
    self.a2.second_author = first_author
    self.a2.save()
    r1 = Reference.objects.create(article_id=self.a1.pk)
    r2 = Reference.objects.create(article_id=self.a2.pk)
    self.assertSequenceEqual(Reference.objects.all(), [r2, r1])
