def to_html(self, verbose: bool = False, **kwargs) -> str:
        """
        Returns the HTML representation of this instance.

        If the *verbose* keyword argument is passed as *True*, returns the
        entire header as JSON. Otherwise, returns an HTML link to this instance
        in the admin site.

        Parameters
        ----------
        verbose : bool, optional
            Whether to return all of the header information or just a link, by
            default False

        Returns
        -------
        str
            HTML text containing either JSON encoded header information or a
            link to the admin site
        """

        if verbose:
            return Html.json(self.value)
        text = f"Csa Header #{self.id}"
        return Html.admin_link("DataElementValue", self.id, text)
    def test_to_html(self):
        """
        Tests that the instance's :meth:`~django_dicom.models.values.PersonName.to_html`
        method returns the required pattern.

        """
        expected = Html.json(TEST_PERSON_NAME["value"])
        result = self.person.to_html()
        self.assertEqual(result, expected)
示例#3
0
    def to_html(self, **kwargs) -> str:
        """
        Returns the HTML representation of this instance.

        Returns
        -------
        str
            HTML representation of this instance
        """

        return Html.json(self.value)
示例#4
0
    def to_html(self, verbose: bool = False, **kwargs) -> str:
        """
        Returns an HTML representation of this instance.

        Parameters
        ----------
        verbose : bool, optional
            Whether to return a JSON with all of the header information or just
            a link to this instance's admin page, by default False.

        Returns
        -------
        str
            HTML representaion of this instance
        """

        if verbose:
            return Html.json(self.to_verbose_list())
        text = f"Header #{self.id}"
        return Html.admin_link("Header", self.id, text)