Beispiel #1
0
def search_results(query):
    #tokenize
    terms = re.split('\s', query)
    #generate regular expression from tokens
    x = "|".join(map(str, terms))
    regx = re.compile(x, re.IGNORECASE)
    #query database
    pins = Pin.objects(Q(title=regx) | Q(dscrp=regx))
    if current_user != None:
        pins = Pin.objects(Q(title=regx) | Q(dscrp=regx))
        valid_pins = getValidBrowserPins(pins, current_user)
    return render_template("index.html", pins=valid_pins, upform=UploadForm())
Beispiel #2
0
def search():
    #get form input
    query = request.form.get('q')
    #tokenize
    terms = re.split('\s', query)
    #generate regular expression from tokens
    x = "|".join(map(str, terms))
    regx = re.compile(x, re.IGNORECASE)
    #query database
    pins = Pin.objects(Q(title=regx) | Q(dscrp=regx))
    return render_template("index.html", pins=pins, upform=UploadForm())
Beispiel #3
0
def favorites(uname):
    user = User.objects.get(uname=uname)
    pins = Pin.objects(favs__contains=user.to_dbref())
    valid_pins = getValidBrowserPins(pins, current_user)
    return render_template('profilepins.html', pins=valid_pins, upform=UploadForm(), user=user)
Beispiel #4
0
def profile_pins(uname):
    user = User.objects.get(uname=uname)
    pins = Pin.objects(pinner=user.to_dbref()).order_by('-date')
    valid_pins = getValidBrowserPins(pins, current_user)
    return render_template('profilepins.html', pins=valid_pins, upform=UploadForm(), user=user)
Beispiel #5
0
def favorites():
    pins = Pin.objects(favs__contains=current_user.to_dbref())
    return render_template("profilepins.html", pins=pins, upform=UploadForm())
Beispiel #6
0
def profilepins():
    pins = Pin.objects(pinner=current_user.to_dbref()).order_by("-date")
    return render_template("profilepins.html", pins=pins, upform=UploadForm())
Beispiel #7
0
def favorites(uname):
    user = User.objects.get(uname=uname)
    pins = Pin.objects(favs__contains=user.to_dbref())
    return render_template('profilepins.html', pins=pins, upform=UploadForm(), user=user)
Beispiel #8
0
def profilepins(uname):
    user = User.objects.get(uname=uname)
    pins = Pin.objects(pinner=user.to_dbref()).order_by('-date')
    return render_template('profilepins.html', pins=pins, upform=UploadForm(), user=user)