forms.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:mendelmd 作者: raonyguimaraes 项目源码 文件源码
def label_from_instance(self, obj):
        """
        Return option label representation from instance.

        Can be overridden to change the representation of each choice.

        Example usage::

            class MyWidget(ModelSelect2Widget):
                def label_from_instance(obj):
                    return force_text(obj.title).upper()

        Args:
            obj (django.db.models.Model): Instance of Django Model.

        Returns:
            str: Option label.

        """
        return force_text(obj)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号