开发者

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

开发者 https://www.devze.com 2023-02-11 08:58 出处:网络
class MaleManager(models.Manager): def get_query_set(self): return super(\'here should be EmployeeManager\', self).get_query_set().filter(sex=\'male\')
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

精彩评论

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