bananas/admin/api/mixins.py
def get_view_name(self, respect_name=True):
        """
        Get or generate human readable view name.
        Extended version from DRF to support usage from both class and instance.
        """
        if isinstance(self, type):
            view = self
        else:
            view = self.__class__

        # Name may be set by some Views, such as a ViewSet.
        if respect_name:
            name = getattr(view, "name", None)
            if name is not None:
                return name

        name = view.__name__
        for suffix in ("ViewSet", "View", "API", "Admin"):
            name = formatting.remove_trailing_string(name, suffix)
        name = formatting.camelcase_to_spaces(name)

        # Suffix may be set by some Views, such as a ViewSet.
        suffix = getattr(view, "suffix", None)
        if suffix:
            name += " " + suffix

        return name
def get_view_name(self, respect_name=True):
        if isinstance(self, type):
            view = self
        else:
            view = self.__class__

        # Name may be set by some Views, such as a ViewSet.
        if respect_name:
            name = getattr(view, "name", None)
            if name is not None:
                return name

        name = view.__name__
        for suffix in ("ViewSet", "View", "API", "Admin"):
            name = formatting.remove_trailing_string(name, suffix)
        name = formatting.camelcase_to_spaces(name)

        # Suffix may be set by some Views, such as a ViewSet.
        suffix = getattr(view, "suffix", None)
        if suffix:
            name += " " + suffix

        return name
def get_view_name ( self , respect_name = True ) : if isinstance ( self , type ) : view = self else : view = self . __class__ # Name may be set by some Views, such as a ViewSet. if respect_name : name = getattr ( view , "name" , None ) if name is not None : return name name = view . __name__ for suffix in ( "ViewSet" , "View" , "API" , "Admin" ) : name = formatting . remove_trailing_string ( name , suffix ) name = formatting . camelcase_to_spaces ( name ) # Suffix may be set by some Views, such as a ViewSet. suffix = getattr ( view , "suffix" , None ) if suffix : name += " " + suffix return name
Get or generate human readable view name.
        Extended version from DRF to support usage from both class and instance.
Get or generate human readable view name . Extended version from DRF to support usage from both class and instance .