@staticmethod
    def compute_next_display_position(review_request):
        # Right now, display_position is monotonically increasing for each
        # review request. In the future this might be extended to allow the
        # user to change the order of attachments on the page.
        max_position = (
            FileAttachmentHistory.objects
            .filter(review_request=review_request)
            .aggregate(Max('display_position'))
            .get('display_position__max')) or 0

        return max_position + 1
Compute the display position for a new FileAttachmentHistory.
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/attachments/models.py/FileAttachmentHistory.compute_next_display_position