def respond_view(request): author = Author.get_by_user(request.user) invite = author.invites.filter(id=request.POST['id']).first() if not invite: return jsonify(success=False) if request.POST['accept'] == 'true': padmember = PadMember(pad=invite.pad, role=invite.role, author=author) padmember.save() invite.delete() return jsonify(success=True)
def create_view(request): 'Creates an Etherpad-Lite Pad' e = get_etherpad_client() # Create a group for sharing functionality groupid = e.createGroup()['groupID'] # Create a pad on the group padid = e.createGroupPad(groupID=groupid, padName='ek')['padID'] # Store reference to the group and pad pad = Pad(groupid=groupid, padid=padid) pad.save() user = request.user author = Author.get_by_user(user) # Set current padmember = PadMember(pad=pad, role='owner', author=author) padmember.save() return open_etherpad(pad, author, epoch_time(604800), e, id=padmember.id)