开发者

Django-python: how to pass argument from child class to parent class?

class MaleManager(models.Manager):
   def get_query_set(self):
      return super('here should be EmployeeManager', self).get_query_set().filter(sex='male')

# Need to pass class name Employee开发者_Python百科Manager to MaleManager

class EmployeeManager(MaleManager):
    def get_query_set(self):
        return super(EmployeeManager, self).get_query_set()

So what I want to do here is passing EmployeeManager to GenericManager, and now have no Idea how to do that?


If for, whatever reason, what you've described actually does make sense, you might be looking for the self.__class__ property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜