示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 def post(self, topic_id):
     slot_id = int(self.request.get("slot_id"))
     local_time = self.request.get("local_time")
     action = self.request.get("action")
     topic_slot = TopicSlot.get_by_id(slot_id)
     rsvp = TopicRSVP.get_for_user_and_slot(users.get_current_user(),
                                            topic_slot)
     if not rsvp and action == "signup":
         rsvp = TopicRSVP(slot=topic_slot,
                          attendee=users.get_current_user(),
                          local_time=local_time)
         rsvp.put()
         self.redirect(topic_slot.full_link)
     if rsvp and action == "unsignup":
         rsvp.delete()
         self.render_signup(topic_id)
示例#6
0
 def post(self, topic_id):
     slot_id = int(self.request.get("slot_id"))
     local_time = self.request.get("local_time")
     action = self.request.get("action")
     topic_slot = TopicSlot.get_by_id(slot_id)
     rsvp = TopicRSVP.get_for_user_and_slot(users.get_current_user(), topic_slot)
     if not rsvp and action == "signup":
         rsvp = TopicRSVP(slot=topic_slot, attendee=users.get_current_user(), local_time=local_time)
         rsvp.put()
         self.redirect(topic_slot.full_link)
     if rsvp and action == "unsignup":
         rsvp.delete()
         self.render_signup(topic_id)