def logout(): # Clear out guests and checkins if demo account cur_user = current_user() if cur_user.is_demo: # Delete guest objects, checkin objects, and user object guests = Guest.query(Guest.restaurant_key==cur_user.key).fetch() for guest in guests: checkins = CheckIn.query(CheckIn.guest_key==guest.key).fetch() for checkin in checkins: checkin.key.delete() guest.key.delete() for msg in Message.query(Message.restaurant_key==cur_user.key).fetch(): msg.key.delete() for msgTemplate in MessageTemplate.query(MessageTemplate.restaurant_key==cur_user.key).fetch(): msgTemplate.key.delete() cur_user.key.delete() # Logs out User logout_account() return redirect(users.create_logout_url("/"))
def get_optins(self): from src.guests.models import Guest return Guest.query(Guest.restaurant_key==self.key,Guest.opt_in==True).fetch()
def get_guests(self): from src.guests.models import Guest return Guest.query(Guest.restaurant_key==self.key).fetch()