def admin_showreqs():
    committees = get_committees()
    if current_user.is_admin == True:
        requests = Requests.query.filter(Requests.approved == False)
        return render_template("admin_pendingrequests.html", posts = requests, committees = committees)
    else:
        return render_template("404.html")
Exemple #2
0
def showtag(tagid):
    committees = get_committees()
    if tagid == 'all':
        posts = Requests.query.all()
    else:
        posts = Requests.query.filter(Requests.tags == tagid)
    return render_template('requests.html', posts=posts, committees=committees)
def showtag(tagid):
    committees = get_committees()
    if tagid == 'all':
        posts = Requests.query.all()
    else :
        posts = Requests.query.filter(Requests.tags == tagid)
    return render_template('requests.html', posts = posts, committees = committees)
def change():
    if request.method == 'POST':
        
        #owner = request.form['owner']
        title = request.form['title']
        subtitle = request.form['subtitle']
        content = request.form['content']
        #supporters = request.form['supporters']
        status = request.form['status'] #public/private
        approved = False
        tags = request.form['tags']
        subtitle = request.form['subtitle']
        priority_str = request.form['priority_str']
        '''id_ = current_user.get_id()
        user = User.query.filter_by(User.id == id_).first()
        print user.webmailid'''

        priority = 0
        if priority_str == 'Low':
            priority = 1
        elif priority_str == 'Medium':
            priority = 2
        else:
            priority = 3
        #priority = request.form['priority']
        date = datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y")
        comments_no = 0

        newrequest = Requests(current_user.id, title, subtitle, content, str(current_user.id), status, False, tags, priority, date, comments_no)
        db.session.add(newrequest)
        db.session.commit()
        #return "POSTED"
        return redirect('/show')
    else:
        return render_template('change.html', committees = get_committees())
Exemple #5
0
def admin_showreqs():
    committees = get_committees()
    if current_user.is_admin == True:
        requests = Requests.query.filter(Requests.approved == False)
        return render_template("admin_pendingrequests.html",
                               posts=requests,
                               committees=committees)
    else:
        return render_template("404.html")
def show_reqs():
	committees = get_committees()
	searchtext = request.args.get('search')
	if searchtext is None:
		requests = Requests.query.filter(Requests.approved == True)
		return render_template("requests.html", posts = requests, committees = committees)
	else:
		allrequests = Requests.query.filter(Requests.approved == True)
		requests = []
		for req in allrequests:
			#or searchtext in req.subtitle or searchtext in req.content
			if searchtext in req.title :
				requests.append(req)		
		return render_template("requests.html", posts = requests, committees = committees)
Exemple #7
0
def show_reqs():
    committees = get_committees()
    searchtext = request.args.get('search')
    if searchtext is None:
        requests = Requests.query.filter(Requests.approved == True)
        return render_template("requests.html",
                               posts=requests,
                               committees=committees)
    else:
        allrequests = Requests.query.filter(Requests.approved == True)
        requests = []
        for req in allrequests:
            #or searchtext in req.subtitle or searchtext in req.content
            if searchtext in req.title:
                requests.append(req)
        return render_template("requests.html",
                               posts=requests,
                               committees=committees)
Exemple #8
0
def change():
    if request.method == 'POST':

        #owner = request.form['owner']
        title = request.form['title']
        subtitle = request.form['subtitle']
        content = request.form['content']
        #supporters = request.form['supporters']
        status = request.form['status']  #public/private
        approved = False
        tags = request.form['tags']
        subtitle = request.form['subtitle']
        priority_str = request.form['priority_str']
        '''id_ = current_user.get_id()
        user = User.query.filter_by(User.id == id_).first()
        print user.webmailid'''

        priority = 0
        if priority_str == 'Low':
            priority = 1
        elif priority_str == 'Medium':
            priority = 2
        else:
            priority = 3
        #priority = request.form['priority']
        date = datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y")
        comments_no = 0

        newrequest = Requests(current_user.id, title, subtitle, content,
                              str(current_user.id), status, False, tags,
                              priority, date, comments_no)
        db.session.add(newrequest)
        db.session.commit()
        #return "POSTED"
        return redirect('/show')
    else:
        return render_template('change.html', committees=get_committees())