Пример #1
0
def message():
    if not session.get('logged_in'):
    	return index()

    name = session['logged_name']
    pets = session['pets_code']

    message = MessageController()
    pet_list = []
    pet_list = message.getAll(pets)

    message_size = message.count(pets)

    return render_template('message.html', name = name, message_size = message_size, pet_list = pet_list)
Пример #2
0
def readMessage():

    name = session['logged_name']
    pets = session['pets_code']

    messages = MessageController()
    messages.markAsRead(request)

    pet_list = []
    pet_list = messages.getAll(pets)

    message_size = len(pet_list)
    return render_template('message.html',
                           name=name,
                           message_size=message_size,
                           pet_list=pet_list)
Пример #3
0
def profile():
    if not session.get('logged_in'):
    	return index()

    code = session['logged_code']
    name = session['logged_name']
    pets = session['pets_code']

    req = getUser(code)
    user = json.loads(req.text)

    message = MessageController()
    pet_list = []
    pet_list = message.get(pets)

    message_size = len(pet_list)

    return render_template('profile.html', name = name, user = user, message_size = message_size, pet_list = pet_list)
Пример #4
0
def dashBoard():
    if not session.get('logged_in'):
    	return index()

    code = session['logged_code']
    name = session['logged_name']
    pets = session['pets_code']
    
    req = getPets(code)
    list_pets = json.loads(req.text)

    message = MessageController()
    pet_list = []
    pet_list = message.get(pets)

    message_size = len(pet_list)

    return render_template('dash.html', name = name, list_pets = list_pets, message_size = message_size, pet_list = pet_list)
Пример #5
0
def auth():
    error = None
    pets = []
    pet_list = []

    login = LoginController()
    req = login.auth(request)

    response = json.loads(req.text)
    print response
    auth = response['auth']
    name = response['name']
    code = response['code']

    if auth:

        req = getPets(code)
        list_pets = json.loads(req.text)

        message = MessageController()

        for pet in list_pets['pets']:
            pets.append(pet['image_id'])

        pet_list = message.get(pets)
        message_size = len(pet_list)

        session['logged_in'] = True
        session['pets_code'] = pets
        session['logged_name'] = name
        session['logged_code'] = code

        return render_template('dash.html',
                               name=name,
                               list_pets=list_pets,
                               message_size=message_size,
                               pet_list=pet_list)
    else:
        error = 'Login ou Senha invalidos'

    return render_template('login.html', error=error)
Пример #6
0
def addMessage():
    messages = MessageController()
    messages.save(request)
    return index()