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.
精彩评论