Beispiel #1
0
def mock(Tripname):
    trips = Trips.query.filter_by(tripName=Tripname).first()
    if trips:
        if trips.status == 1 and trips.visibility == 0:
            # this will increment the given views num of a trip
            trips.viewsNum = trips.viewsNum + 1

            user = User.query.filter_by(id=trips.userID).first()
            itern = Itineraries.query.filter_by(tripID=trips.tripID).all()

            # this will be used for suggestion tab in the template
            all_trips = Trips.query.filter_by(userID=user.id).limit(4)

            db.session.add(trips)
            db.session.commit()
            return render_template('view_trip.html', 
                                    title=trips.tripName, 
                                    trips=trips, 
                                    label=verify(),
                                    ite=itern, 
                                    user=user, 
                                    ph_1=determine_pic(user, 0), 
                                    suggestedTrips=all_trips,
                                    collide=True)

    return render_template('notPermitted.html', 
                            label=verify(), 
                            title='Not Permitted', 
                            collide=True)
Beispiel #2
0
def exp_(linklabel='all trips made in this site'):
    til = linklabel
    trips = trip_query_0(str(linklabel)).paginate(1, POSTS_PER_PAGE, False)

    main_count = main_determiner(len(trip_query_0(linklabel).all()))

    count_ = [
        max_for_most, max_for_new,
        len(Trips.query.order_by(Trips.tripID).all())
    ]
    lbl = ['most-popular', 'newest-trip-plans', 'all trips made in this site']

    if linklabel in lbl:
        for index, r in enumerate(lbl):
            if linklabel == r:
                til = til_(index)
                trips = trip_query_mod_1(index, 1)
                main_count = main_determiner(count_[index])

    elif linklabel == 'filtered_result':
        for index_1, r_1 in enumerate(lbl):
            if request.args.get('option') == r_1:
                trips = trip_query_for_fil(index_1, 1,
                                           str(request.args.get('country')),
                                           str(request.args.get('city')))
                main_count = main_determiner(count_[index_1])

        change_val(str(request.args.get('option')),
                   str(request.args.get('country')),
                   str(request.args.get('city')))

        return render_template('exp_newtrip.html',
                               path=0,
                               title=til,
                               trips=trips,
                               label=verify(),
                               search_label=request.args.get('city'),
                               numm=main_count,
                               stry=linklabel)

    return render_template('exp_newtrip.html',
                           path=0,
                           title=til,
                           trips=trips,
                           label=verify(),
                           search_label=til,
                           numm=main_count,
                           stry=linklabel)
Beispiel #3
0
def view_each(linklabel='all trips made in this site'):
    label=verify()
    til='Search Result'
    trips = db.session.query(Trips).filter(func.concat(Trips.tripName, ' ', Trips.tripDateFrom, ' ', Trips.tripDateTo).like('%'+linklabel+'%')).all()
    if linklabel=='most-popular':
        til='Most Popular'
        trips = Trips.query.order_by(Trips.tripID).limit(8).all()
        linklabel='Most Popular'
    elif linklabel=='newest-trip-plans':
        til='Newest Trips'
        trips = Trips.query.order_by(desc(Trips.tripID)).limit(8).all()
        linklabel='Newest Trip Plans'
    elif linklabel=='all trips made in this site':
        til='All Trips'
        trips = Trips.query.order_by(Trips.tripID).all()
        linklabel='All Trips'
    elif linklabel=='filtered_result':
        trip_ = []
        if request.args.get('option')=='all-trips':
            trips = Trips.query.order_by(Trips.tripID).all()
        elif request.args.get('option')=='most-popular':
            trips = Trips.query.order_by(Trips.tripID).all()
        elif request.args.get('option')=='newest-trip-plans':
            trips = Trips.query.order_by(desc(Trips.tripID)).all()

        for trip in trips:
            if (request.args.get('country') in trip.tripName) or (request.args.get('city') in trip.tripName):
                trip_.append(trip)
        return render_template('trip-plans.html', title=til, trips=trip_, label=label, search_label=request.args.get('city'))
    return render_template('trip-plans.html', title=til, trips=trips, label=label, search_label=linklabel)
Beispiel #4
0
def index():
    trip_index = trip_query_1(1, 4)
    trip_index_most = trip_query_2(1, 4)
    return render_template('index.html',
                           title='TravelPlanner-Home',
                           trips=trip_index,
                           trips_m=trip_index_most,
                           label=verify())
Beispiel #5
0
def mock(Tripname):
    trips = Trips.query.filter_by(tripName=Tripname).first()
    trips.viewsNum = trips.viewsNum + 1
    db.session.add(trips)
    db.session.commit()
    label = []
    label = verify()
    return render_template('view_trip.html', title=trips.tripName, trips=trips, label=label)
Beispiel #6
0
def siteSearch():
    #main_count = main_determiner(len(trip_query_0(request.args.get('search_1')).all()))
    trips, main_count = trip_query_4(1, request.args.get('search_1'))
    return render_template('search.html',
                           title='Search Result',
                           label=verify(),
                           trips=trips,
                           stry=request.args.get('search_1'),
                           numm=main_count)
Beispiel #7
0
def exp_(linklabel='all trips made in this site'):
    til = linklabel
    trips = alternateSearchResult(str(linklabel)).paginate(1, POSTS_PER_PAGE, False)

    main_count = pageNumberDeterminer(len(alternateSearchResult(linklabel).all()))

    count_ = [max_for_most, max_for_new, len(Trips.query.order_by(Trips.tripID).all())]
    lbl = ['most-popular', 'newest-trip-plans', 'all trips made in this site']

    if linklabel in lbl:
        for index, r in enumerate(lbl):
            if linklabel == r:
                til = tripPlansTitle(index)
                trips = categoryResult(index, 1)
                main_count = pageNumberDeterminer(tripBASE().count())

    elif linklabel == 'filtered_result':
        for index_1, r_1 in enumerate(lbl):
            vim = request.args.get('option')
            if str(vim) == r_1:
                trips = filterSearchResultHandler(n=index_1, base_string1=str(request.args.get('country')), base_string2=str(request.args.get('city'))).paginate(1, POSTS_PER_PAGE, False)
                main_count = pageNumberDeterminer(filterSearchResultHandler(index_1, str(request.args.get('country')), str(request.args.get('city'))).count())

        change_val(str(request.args.get('option')), str(request.args.get('country')), str(request.args.get('city')))

        return render_template('exp_newtrip.html',
                                path=0, 
                                title=til, 
                                trips=trips, 
                                label=verify(),
                                search_label=request.args.get('city'), 
                                numm=main_count, 
                                stry=linklabel)


    return render_template('exp_newtrip.html', 
                            path=0, 
                            title=til, 
                            trips=trips, 
                            label=verify(),
                            search_label=til, 
                            numm=main_count, 
                            stry=linklabel, 
                            collide=False)
Beispiel #8
0
def siteSearch():
    keyword_ = request.args.get('search_1')
    trips, main_count = mainSearch(num=1, var=str(keyword_))
    return render_template('search.html', 
                            title='Search Result', 
                            label=verify(),
                            trips=trips, 
                            stry=request.args.get('search_1'), 
                            numm=main_count, 
                            collide=False, 
                            path=0)
Beispiel #9
0
def index():
    featured = Trips.query.filter_by(featuredTrip=1).limit(4)
    #Newest trips
    trip_index = tripBASE().order_by(desc(Trips.tripID)).paginate(1, 4, False)
    #Most Viewed Trips
    trip_index_most = tripBASE().order_by(desc(Trips.viewsNum)).paginate(1, 4, False)
    return render_template('index.html', 
                            title='TravelPlanner-Home', 
                            featured=featured, 
                            trips=trip_index, 
                            trips_m=trip_index_most,
                            label=verify(), 
                            collide=True)
Beispiel #10
0
def mock(Tripname):
    trips = Trips.query.filter_by(tripName=Tripname).first()
    trips.viewsNum = trips.viewsNum + 1

    user = User.query.filter_by(id=trips.userID).first()

    itern = Itineraries.query.filter_by(tripID=trips.tripID).all()

    all_trips = Trips.query.filter_by(userID=user.id).limit(4)

    db.session.add(trips)
    db.session.commit()
    return render_template('view_trip.html',
                           title=trips.tripName,
                           trips=trips,
                           label=verify(),
                           ite=itern,
                           user=user,
                           ph_1=determine_pic(user, 0),
                           suggestedTrips=all_trips)
Beispiel #11
0
def sendUs():
    return render_template('response.html', title='Response', label=verify(), collide=True)
Beispiel #12
0
def about():
    return render_template('about.html', title='About', label=verify(), collide=True)
Beispiel #13
0
def index():
    label=verify()
    trips = Trips.query.order_by(desc(Trips.tripID)).paginate(1, POSTS_PER_PAGE, False)
    trips_for_most = Trips.query.order_by(Trips.tripID).paginate(1, POSTS_PER_PAGE, False)
    return render_template('index.html', title='TravelPlanner-Home', trips=trips, trips_m=trips_for_most, label=label)