def events(cls, user): result = [] user_role_name_filter = compose_filter( ["program_role", "user_role", "name"], cls.USER_ROLE) for prg in user.programrolegrant_set.filter(**user_role_name_filter): result.append(cls(prg)) return result
def events(cls, organization): result = [] for startup in organization.startups.all(): for ss in startup.startupstatus_set.filter(**compose_filter( ["program_startup_status", "startup_role", "name"], StartupRole.FINALIST)): result.append(cls(ss)) return result
def events(cls, organization): result = [] for startup in organization.startups.all(): for ss in startup.startupstatus_set.filter(**compose_filter([ "program_startup_status", "startup_role", "name", "icontains" ], "winner")): result.append(cls(ss)) return result
def _find_startups(self): startups = Startup.objects.filter( startupstatus__program_startup_status__program=self.data.program) if self.data.startup_statuses: startups = startups.filter(**compose_filter( STARTUP_IN_STATUSES, self.data.startup_statuses)) # The following assumes that if any of the # ProgramStartupStatuses in this group are not # approved to include stealth startups then # stealth startups are excluded. if self.data.startup_statuses.filter( include_stealth_startup_names=False): startups = startups.exclude(is_visible=False) else: non_stealth = Q(is_visible=True) has_stealth_status = Q( **compose_filter(STARTUP_TO_STEALTH_STATUS, True)) startups = startups.filter(non_stealth | has_stealth_status) return self._add_ordering(startups.distinct())
def _status_group_data(self): status_group = self.data.group_by[len(self.data.STATUS_GROUP_PREFIX):] startups = self._find_startups().filter( **compose_filter(STARTUP_TO_STATUS_GROUP, status_group)) return self._generate_group_data(startups, lambda _: status_group)
def _get_jobs(self): if self.data.startup: return JobPosting.objects.filter(startup=self.data.startup) return JobPosting.objects.filter( **compose_filter(JOBS_IN_PROGRAMS, self._programs())).distinct()