Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何访问django管理类中的模型方法_Python_Django - Fatal编程技术网

Python 如何访问django管理类中的模型方法

Python 如何访问django管理类中的模型方法,python,django,Python,Django,我有一个这样的代理模型 class Category(GenericCategory): class Meta: proxy = True verbose_name = "Category" verbose_name_plural = "Categories" @property def get_content_type(self): return ContentTy

我有一个这样的代理模型

class Category(GenericCategory):
    class Meta:
        proxy = True
        verbose_name = "Category"
        verbose_name_plural = "Categories"

    @property
    def get_content_type(self):
        return ContentType.objects.get_for_model(
            self.__class__, for_concrete_model=False
        )
现在我想访问django admin类中的get_content_type方法,以便在django admin中过滤数据