def __init__(self, project): self.project_type = get_project_type(project) if self.project_type == 'bplan': project = project.externalproject.bplan elif self.project_type == 'external': project = project.externalproject elif self.project_type == 'container': project = project.projectcontainer super().__init__(project)
def is_effective(self, project): project_type = get_project_type(project) return project_type == 'bplan'
def get_url(self, instance): if get_project_type(instance) in ('external', 'bplan'): return instance.externalproject.url return instance.get_absolute_url()
def get_subtype(self, instance): subtype = get_project_type(instance) if subtype in ('external', 'bplan'): return 'external' return subtype
def item_type(self): if get_project_type(self.project) in ('external', 'bplan'): return 'external' return 'project'
def is_container(project): return get_project_type(project) == 'container'
def is_external(project): return get_project_type(project) in ('external', 'bplan')
def project_type(project): return get_project_type(project)
def project_url(project): if get_project_type(project) in ('external', 'bplan'): return project.externalproject.url return project.get_absolute_url()
def is_effective(self, project): project_type = get_project_type(project) return project_type == 'external'