def get(self): user = users.get_current_user() user_topics = Topic.get_for_user(user) user_rsvps = [] for rsvp in TopicRSVP.get_for_user(user): rsvp.topic = rsvp.slot.topic user_rsvps.append(rsvp) template_values = self.get_template_values() template_values['topics'] = user_topics template_values['rsvps'] = user_rsvps self.render('dashboard.html', template_values)
def render_signup(self, topic_id): topic = Topic.get_by_id(int(topic_id)) topic_slots = topic.slots user_rsvps = [rsvp.slot.id for rsvp in TopicRSVP.get_for_user(users.get_current_user())] slots = [] for slot in topic_slots: slot.rsvp_count = slot.rsvps.count() or 0 slot.user_rsvped = (slot.id in user_rsvps) slots.append(slot) slots = sorted(slots, key=lambda slot: slot.start) template_values = self.get_template_values() template_values['topic'] = topic template_values['topic_slots'] = slots self.render('signup.html', template_values)
def render_signup(self, topic_id): topic = Topic.get_by_id(int(topic_id)) topic_slots = topic.slots user_rsvps = [ rsvp.slot.id for rsvp in TopicRSVP.get_for_user(users.get_current_user()) ] slots = [] for slot in topic_slots: slot.rsvp_count = slot.rsvps.count() or 0 slot.user_rsvped = (slot.id in user_rsvps) slots.append(slot) slots = sorted(slots, key=lambda slot: slot.start) template_values = self.get_template_values() template_values['topic'] = topic template_values['topic_slots'] = slots self.render('signup.html', template_values)