def create_talk(request, session, room_id): room = Room.get_by_key_name(room_id) talk = Talk(title = 'New Talk', room = room, session = int(session)) if request.method == "GET": return show_talk_form_to_edit(request, TalkForm(instance=talk)) else: return save_talk_form(request, talk)
def __init__(self): for session in Talk.get_talk_sessions(): room_dict = {} for room in Room.get_rooms(): room_dict[room.name] = None self.grid[session]= dict(room_dict) for talk in Talk.all().fetch(1000): if talk.session: self.add_talk(talk)
def get_rows_for_template(self): session_rows = [] contador = 0 for session in Talk.get_talk_sessions(): row = SessionRow(session) for room in Room.get_rooms(): if self.grid[session][room.name]: self.grid[session][room.name].contador = contador row.add_talk(self.grid[session][room.name]) contador = contador + 1 session_rows.append(row) return session_rows
def init_app(request): if request.method == 'GET': User.create_admin('admin', 'aos').put() Room.init_rooms() if not Talk.all().count(1) > 0: talk = Talk(title = 'Android', session=1) talk.set_room(Room.get_rooms()[0]) talk.put() talk = Talk(title = 'Kanban', session=5) talk.set_room(Room.get_rooms()[1]) talk.put() if not Attendant.all().count(1) > 0: bill = Attendant.create('Bill', 'Gates', '*****@*****.**', 'Zaragoza', False) bill.twitter_id = 'fbgblog' bill.set_as_speaker() bill.put() richard = Attendant.create('Richard', 'Stallman', '*****@*****.**', 'Pamplona', True) richard.twitter_id = 'GNUplusLINUX' richard.set_as_speaker() richard.put() return HttpResponse("App ready to rumble...", mimetype="text/plain")
def show_timetable(request): user = request.session.get('user') timetable = Timetable() rooms = Room.get_rooms() sessions = Talk.get_talk_sessions() return render_to_response('timetable_app.html', {'user': user, 'rooms': rooms, 'sessions': sessions, 'rows': timetable.get_rows_for_template()})