def __init__(self, *args, **kwargs): self.event = kwargs.pop('event') super(VCRoomLinkFormBase, self).__init__(*args, **kwargs) contrib_choices = [(contrib.id, contrib.title) for contrib in sorted(self.event.contributions, key=attrgetter('title'))] blocks = SessionBlock.find(SessionBlock.session.has((Session.event_new == self.event) & ~Session.is_deleted)) block_choices = [(block.id, block.full_title) for block in sorted(blocks, key=attrgetter('full_title'))] self.contribution.choices = [('', _("Please select a contribution"))] + contrib_choices self.block.choices = [('', _("Please select a session block"))] + block_choices
def __init__(self, *args, **kwargs): self.event = kwargs.pop('event') super().__init__(*args, **kwargs) contrib_choices = [(contrib.id, contrib.title) for contrib in sorted(self.event.contributions, key=attrgetter('title'))] blocks = SessionBlock.find(SessionBlock.session.has((Session.event == self.event) & ~Session.is_deleted)) block_choices = [(block.id, block.full_title) for block in sorted(blocks, key=attrgetter('full_title'))] self.contribution.choices = [('', _("Please select a contribution"))] + contrib_choices self.block.choices = [('', _("Please select a session block"))] + block_choices
def _query_blocks(event_ids, dates_overlap, detail_level='session'): options = [subqueryload('session').joinedload('blocks').joinedload('person_links')] if detail_level == 'contribution': options.append(joinedload(SessionBlock.timetable_entry).joinedload(TimetableEntry.children)) else: options.append(joinedload(SessionBlock.timetable_entry)) return (SessionBlock.find(~Session.is_deleted, Session.event_id.in_(event_ids), dates_overlap(TimetableEntry)) .options(*options) .join(TimetableEntry).join(Session))