def __init__(self, *args, **kwargs):
        self.document = kwargs.pop('document', None)
        super(DocumentContentForm, self).__init__(*args, **kwargs)
        content = []
        self.fields['contents'].initial = ''
        try:
            document_pages = self.document.pages.all()
        except __HOLE__:
            document_pages = []

        for page in document_pages:
            try:
                page_content = page.ocr_content.content
            except DocumentPageContent.DoesNotExist:
                pass
            else:
                content.append(conditional_escape(force_unicode(page_content)))
                content.append(
                    '\n\n\n<hr/><div class="document-page-content-divider">- %s -</div><hr/>\n\n\n' % (
                        ugettext(
                            'Page %(page_number)d'
                        ) % {'page_number': page.page_number}
                    )
                )

        self.fields['contents'].initial = mark_safe(''.join(content))
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/ocr/forms.py/DocumentContentForm.__init__