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)
Esempio n. 2
0
    def admin_link(self) -> str:
        """
        Returns an HTML tag linking to this instance in the admin site.

        Returns
        -------
        str
            HTML link to this instance
        """

        model_name = self.__class__.__name__
        return Html.admin_link(model_name, self.id)
    def admin_link(self) -> str:
        """
        Creates an HTML tag to link to this instance within the admin site.

        Returns
        -------
        str
            Link to this instance in the admin site
        """

        model_name = self.__class__.__name__
        return Html.admin_link(model_name, self.id)
    def get_admin_link(self, text: str = None) -> str:
        """
        Returns an HTML link to this instance's page in the admin site.

        Parameters
        ----------
        text : str, optional
            Text to display, by default None

        Returns
        -------
        str
            HTML element
        """

        model_name: str = self.__class__.__name__
        return Html.admin_link(model_name, self.id, text=text)
Esempio n. 5
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)
Esempio n. 6
0
 def id_link(self, series: Series) -> str:
     return Html.admin_link("Series", series.id)