Exemplo n.º 1
0
def index():
    """Index of the client side"""
    latest_messages = current_user.contacts_latest_messages()

    return render_template('client/index.html',
                           user=current_user.serialize(),
                           latest_messages=latest_messages)
Exemplo n.º 2
0
def profile():
    subjects = Subject.query.all()

    latest_messages = current_user.contacts_latest_messages()
    u = current_user

    placeholders = {
        'title': u.prof.title,
        'birth_date': u.birth_date.strftime("%d/%m/%Y"),
        'about_me': u.prof.about_me,
    }

    educations = current_user.prof.educations
    experiences = current_user.prof.experiences
    """if request.method == 'POST':
					u.client.about_me = request.form['aboutMe']
					#print request.form['birth_date']
					u.birth_date = datetime.strptime(request.form['birthDate'], "%d/%m/%Y")
					db.session.commit()
					flash(u"enregistré!")"""

    return render_template('prof/profile.html',
                           user=current_user.serialize(),
                           prof=current_user.prof,
                           subjects=subjects,
                           educations=educations,
                           experiences=experiences,
                           latest_messages=latest_messages,
                           placeholders=placeholders)
Exemplo n.º 3
0
def search():
    """Where a client looks for profs"""
    latest_messages = current_user.contacts_latest_messages()

    keywords = None
    subject = None

    _subject = request.args.get('subject')
    _keywords = request.args.get('keywords')

    if _subject:
        all_subjects = Subject.query.all()

        for s in all_subjects:
            if s.url_safe_name() == _subject:
                subject = s
                break
    elif _keywords:
        keywords = _keywords

    form_choices = {
        'subjects': Subject.query.all(),
        'levels': Level.query.all(),
        'cities': City.query.all()
    }

    return render_template('client/search.html',
                           user=current_user.serialize(),
                           latest_messages=latest_messages,
                           keywords=keywords,
                           form_choices=form_choices,
                           default_subject=subject,
                           default_keywords=keywords)
Exemplo n.º 4
0
def picture_upload():

    latest_messages = current_user.contacts_latest_messages()

    return render_template('client/picture_upload.html',
                           user=current_user.serialize(),
                           latest_messages=latest_messages)
Exemplo n.º 5
0
def picture_upload():
    #from flask import session
    #session.pop('_flashes', None)

    latest_messages = current_user.contacts_latest_messages()

    return render_template('prof/picture_upload.html',
                           user=current_user.serialize(),
                           prof=current_user.prof,
                           latest_messages=latest_messages)
Exemplo n.º 6
0
def chat(safe_name):
    """a chat view"""
    latest_messages = current_user.contacts_latest_messages()
    latest_messages = current_user.contacts_latest_messages()

    prof_obj = Prof.query.filter(Prof.user == User.query.filter_by(
        safe_name=safe_name).first()).first()

    if not prof_obj:
        abort(404)

    r = room_name(current_user.id, prof_obj.user.id)

    return render_template('client/chat.html',
                           user=current_user.serialize(),
                           prof=prof_obj.serialize(),
                           latest_messages=latest_messages,
                           safe_name=safe_name,
                           room_name=r)
Exemplo n.º 7
0
def profile_overview():
    latest_messages = current_user.contacts_latest_messages()

    prof_obj = current_user.prof

    safe_name = current_user.safe_name

    return render_template('prof/aprof.html',
                           user=current_user.serialize(),
                           prof=prof_obj.serialize(),
                           latest_messages=latest_messages,
                           safe_name=safe_name)
Exemplo n.º 8
0
def fetch_messages_html():
    latest_messages = current_user.contacts_latest_messages()

    for m in latest_messages:
        m.pop('iso_date', None)
        m['message_obj'] = m['message_obj'].serialize()
        m['who'] = m['who'].serialize()

    #print m

    return render_template('prof/_latest_messages.html',
                           latest_messages=latest_messages[:6])
Exemplo n.º 9
0
def search_o():
    """Where a client looks for profs"""
    latest_messages = current_user.contacts_latest_messages()

    keywords = request.args.get('keywords')

    prof_list = Prof.query.all()

    return render_template('client/search.html',
                           user=current_user.serialize(),
                           latest_messages=latest_messages,
                           keywords=keywords,
                           prof_list=prof_list)
Exemplo n.º 10
0
def fetch_messages():
    latest_messages = current_user.contacts_latest_messages()

    for m in latest_messages:
        m.pop('iso_date', None)
        m['message_obj'] = m['message_obj'].serialize()
        m['who'] = m['who'].serialize()

    #print m

    return json.dumps(latest_messages), 200, {
        'ContentType': 'application/json'
    }
Exemplo n.º 11
0
def aprof(safe_name):
    """How a client views a prof"""
    latest_messages = current_user.contacts_latest_messages()
    prof_obj = Prof.query.filter(Prof.user == User.query.filter_by(
        safe_name=safe_name).first()).first()

    if not prof_obj:
        abort(404)

    return render_template('client/aprof.html',
                           user=current_user.serialize(),
                           prof=prof_obj.serialize(),
                           latest_messages=latest_messages,
                           safe_name=safe_name)
Exemplo n.º 12
0
def profile():
    latest_messages = current_user.contacts_latest_messages()
    u = current_user

    placeholders = {
        'about_me': u.client.about_me,
        'birth_date': u.birth_date.strftime("%d/%m/%Y"),
    }
    """if request.method == 'POST':
					u.client.about_me = request.form['aboutMe']
					#print request.form['birth_date']
					u.birth_date = datetime.strptime(request.form['birthDate'], "%d/%m/%Y")
					db.session.commit()
					flash(u"enregistré!")"""

    return render_template('client/profile.html',
                           user=current_user.serialize(),
                           latest_messages=latest_messages,
                           placeholders=placeholders)
Exemplo n.º 13
0
def settings():
    latest_messages = current_user.contacts_latest_messages()

    password_form = ChangePassword()

    wrong_password = False

    if password_form.validate_on_submit():
        if current_user.verify_password(password_form.old_password.data):
            current_user.change_password(password_form.new_password.data)
            db.session.commit()
            flash(u"Nouveau mot de passe enregistré")
            return redirect(url_for('auth.logout'))
        else:
            wrong_password = True

    return render_template('prof/settings.html',
                           user=current_user.serialize(),
                           password_form=password_form,
                           wrong_password=wrong_password,
                           latest_messages=latest_messages)
Exemplo n.º 14
0
def index():
    latest_messages = current_user.contacts_latest_messages()

    return render_template('prof/index.html',
                           user=current_user.serialize(),
                           latest_messages=latest_messages)