예제 #1
0
파일: views.py 프로젝트: carfriends/odin
def show_score(user_id,score_id):
    teams = [t for t in Team.select() if can(auth.get_logged_in_user(),READ,t)]
    user = get_object_or_404(User, User.id == user_id)
    score = get_object_or_404(Score, Score.id == score_id)
    ensure(READ,user)
    users = [u for u in User.select().where(User.team == user.team) if can(auth.get_logged_in_user(),READ,u)]
    return render_template("score_detail.html", active_user=user, teams=teams, users=users, active_team = user.team, score=score)
예제 #2
0
파일: views.py 프로젝트: RustyDust/backend
def show_userlist():
    if auth.get_logged_in_user().admin:
        user_list = Location.select(Location.username, Location.device, Location.topic).distinct().order_by(Location.username.asc())
        return render_template('userlist.html', users = user_list, cur_user = auth.get_logged_in_user())
    else:
        # Only admins can get the full userlist
        # so go away. shoo, shoo.
        return redirect('/devicelist/%s' % auth.get_logged_in_user().username, 302)
예제 #3
0
파일: views.py 프로젝트: carfriends/odin
def user_detail(user_id):
    teams = [t for t in Team.select() if can(auth.get_logged_in_user(),READ,t)]
    user = get_object_or_404(User, User.id == user_id)
    ensure(READ,user)
    scores = Score.select().where(Score.user == user).order_by(Score.created_at.desc())
    users = [u for u in User.select().where(User.team == user.team) if can(auth.get_logged_in_user(),READ,u)]
    pq = PaginatedQuery(scores, 20)
    last_date = datetime.now() - timedelta(days=5)
    return render_template("index.html", active_user=user, teams=teams, users=users, pagination=pq, page=pq.get_page(), active_team = user.team, weeks = [w for w in Week.select().where(Week.end > last_date) if not has_score(w.score_set)])
예제 #4
0
파일: views.py 프로젝트: giskar/shop
def goods_detail(id):
    # good = get_object_or_404(Goods, Goods.id == id)
    if auth.get_logged_in_user():
        name = auth.get_logged_in_user()
        user = User.select().where(User.username == name.username).get()
    else:
        user = ''
    good = Goods.select().where(Goods.id == id).get()
    return render_template('good_detail.html', good=good, user=user)
예제 #5
0
파일: views.py 프로젝트: jeffca/recipes
def private_timeline():
    user = auth.get_logged_in_user()

    messages = Message.select().where(
        Message.user << user.following()).order_by(Message.pub_date.desc())

    return object_list('private_messages.html', messages, 'message_list')
예제 #6
0
def address_create():
	address_form = AddressForm(request.form)
	user = auth.get_logged_in_user()
	if request.method == "POST":
		address = Address(
			user = user,
			street=address_form.street.data,
			zipcode=address_form.zipcode.data,
			state=address_form.state.data,
			country=address_form.country.data
			)
		address.save()
		flash("Address successfully saved")
		return redirect(url_for("dashboard"))
	elif request.method == "GET":
		try:
			exist = Address.select().where(Address.user == user).get()
			return redirect(url_for("address"))
		except Address.DoesNotExist:
			if request.method == "POST":
				address = Address(
					user = user,
					street=address_form.street.data,
					zipcode=address_form.zipcode.data,
					state=address_form.state.data,
					country=address_form.country.data
					)
				address.save()
				flash("Address successfully saved")
				return redirect(url_for("dashboard"))
			else:
				return render_template("address_create.html", address_form=address_form)
예제 #7
0
파일: views.py 프로젝트: wikty/bookmark
def bookmark_add():
    error = {}
    bookmark = {}
    user = auth.get_logged_in_user()
    if request.method == 'POST':
        if not request.form['url']:
            error['url'] = u'书签的网址不能为空'
        if not request.form['url'].startswith('http://') and not request.form['url'].startswith('https://'):
            request.form['url'] = ''.join(['http://', request.form['url']])
        if not error:
            try:
                bookmark = Bookmark.select().where(Bookmark.user == user,
                                        Bookmark.url == request.form['url']
                ).get()
            except Bookmark.DoesNotExist:
                try:
                    db.database.set_autocommit(False)
                    
                    bookmark = Bookmark.create(
                        user=user,
                        url=request.form['url'],
                        title=request.form['title']
                    )
                    bookmark.fetch_image()
                    bookmark.save()

                    tagnames = re.split('\s+', request.form['tags'].strip())
                    # marksure request.form['tags'] not a empty string
                    if tagnames[0]:
                        for tagname in tagnames:
                            if not Tag.select().where(Tag.user == user,
                                                      Tag.name == tagname
                                                     ).exists():
                                tag = Tag.create(user=user, name=tagname)
                                tag.save()

                                relationship = Relationship.create(
                                    user=user,
                                    tag=tag,
                                    bookmark=bookmark)
                                relationship.save()
                except Exception as e:
                    db.database.rollback()
                    flash(u'对不起,服务器太累了,刚罢工了一会儿', 'error')
                else:
                    try:
                        db.database.commit()
                    except Exception as e:
                        db.database.rollback()
                        flash(u'对不起,服务器太累了,刚罢工了一会儿', 'error')
                finally:
                    db.database.set_autocommit(True)

                if not get_flashed_messages():
                    flash(u'你已经成功添加一个书签', 'success')
                    return redirect(url_for('bookmark'))
            else:
                flash(Markup(u'书签已经存在,也许你想要<a href="' + url_for('bookmark_edit', id=bookmark.id) + u'">编辑</a>此书签'), 'info')
    
    return render_template('bookmark_add.html', error=error, form=request.form, user=user, bookmark=bookmark)
예제 #8
0
def edit(note_id):
    user = auth.get_logged_in_user()
    note = get_object_or_404(Note, Note.user == user, Note.id == note_id)

    note.content = request.form.get('content')
    note.save()
    return redirect(url_for('getNotes', note_id=note.id))
예제 #9
0
파일: views.py 프로젝트: wikty/bookmark
def user_settings():
    user = auth.get_logged_in_user()
    error = {}

    if request.method == 'POST':
        if not request.form['email']:
            error['email'] = u'请填写邮箱'
        elif not validate_email(request.form['email']):
            # if you want to validate is avaiable
            # validate_email(request.form['email'], verify=True)
            error['email'] = u'请填写有效的邮箱'
        if not request.form['opassword']:
            error['password'] = u'请输入原密码'
        elif not user.check_password(request.form['opassword']):
            error['password'] = u'原密码不正确'
        elif not request.form['npassword']:
            error['password'] = u'请输入新密码'
        
        if not error:
            user.email = request.form['email']
            user.introduction = request.form['introduction']
            user.set_password(request.form['npassword'])
            user.save()
            
            flash(Markup(u'个人信息刚刚修改完成'), 'success')
                # or directly make user to login
                # auth.login_user(user)
                # return redirect(url_for('bookmark'))
            return redirect(url_for('user_profile', username=user.username))


    return render_template('user_settings.html', user=user, error=error)
예제 #10
0
파일: views.py 프로젝트: coderluka/naucilus
def user_follow(username):
    user = get_object_or_404(User, User.username==username)
    Relationship.get_or_create(
        from_user=auth.get_logged_in_user(),
        to_user=user,
    )
    flash('You are now following %s' % user.username)
    return redirect(url_for('user_detail', username=user.username))
예제 #11
0
def rendersurvey():
    user = auth.get_logged_in_user().username
    rooms= room.select()
    modules = module.select().where(module.instructor == user).order_by(module.module_code)
    return render_template("survey.html", 
                           rooms=rooms,
                           user = user, 
                           modules = modules)
예제 #12
0
파일: views.py 프로젝트: coderluka/naucilus
def user_unfollow(username):
    user = get_object_or_404(User, User.username==username)
    Relationship.delete().where(
        Relationship.from_user==auth.get_logged_in_user(),
        Relationship.to_user==user,
    ).execute()
    flash('You are no longer following %s' % user.username)
    return redirect(url_for('user_detail', username=user.username))
예제 #13
0
def private_timeline():
    user = auth.get_logged_in_user()

    messages = Message.select().where(
        Message.user << user.following()
    ).order_by(Message.pub_date.desc())

    return object_list('private_messages.html', messages, 'message_list')
예제 #14
0
파일: views.py 프로젝트: sekenned/totb
def create():
    user = auth.get_logged_in_user()
    if request.method == "POST" and request.form["content"]:
        message = Message.create(user=user, content=request.form["content"])
        flash("Your message has been created")
        return redirect(url_for("homepage"))

    return render_template("create.html")
예제 #15
0
 def wrapper(*args, **kwargs):
     if requires_login and not auth.get_logged_in_user():
         return jsonify({"error": "login_required", "status": "error"})
     ret = fn(*args, **kwargs)
     obj = {"status": "success"}
     if ret:
         obj.update(ret)
     return jsonify(obj)
예제 #16
0
파일: views.py 프로젝트: jeffca/recipes
def user_unfollow(username):
    user = get_object_or_404(User, User.username == username)
    Relationship.delete().where(
        Relationship.from_user == auth.get_logged_in_user(),
        Relationship.to_user == user,
    ).execute()
    flash('You are no longer following %s' % user.username)
    return redirect(url_for('user_detail', username=user.username))
예제 #17
0
		def wrapper(*args, **kwargs):
			if requires_login and not auth.get_logged_in_user():
				return jsonify({"error": "login_required", "status": "error"})
			ret = fn(*args, **kwargs)
			obj = {"status": "success"}
			if ret:
				obj.update(ret)
			return jsonify(obj)
예제 #18
0
파일: views.py 프로젝트: jeffca/recipes
def user_follow(username):
    user = get_object_or_404(User, User.username == username)
    Relationship.get_or_create(
        from_user=auth.get_logged_in_user(),
        to_user=user,
    )
    flash('You are now following %s' % user.username)
    return redirect(url_for('user_detail', username=user.username))
예제 #19
0
 def create(self):
     if request.method == 'POST':
         if request.form.get('message'):
             Note.create(
                 user=auth.get_logged_in_user(),
                 message=request.form['message'],
             )
     next = request.form.get('next') or self.dashboard_url()
     return redirect(next)
예제 #20
0
def dashboard(msg=None):
	user = auth.get_logged_in_user()
	try:
		books = Books.select().where(
			Books.ownership == user).order_by(Books.id.desc())
		return object_list("book_list.html", books, 'book_list')
	except Books.DoesNotExist:
		return render_template("dashboard.html", msg=msg)
	return render_template("dashboard.html", msg=msg)
예제 #21
0
파일: admin.py 프로젝트: sekenned/totb
 def create(self):
     if request.method == 'POST':
         if request.form.get('message'):
             Note.create(
                 user=auth.get_logged_in_user(),
                 message=request.form['message'],
             )
     next = request.form.get('next') or self.dashboard_url()
     return redirect(next)
예제 #22
0
    def api_current(self):
        """API to acquire the current logged in user information
        """
        obj = auth.get_logged_in_user()

        if obj is None:
            raise BusinessException("Not logged in", 2)

        return self.object_detail(obj)
예제 #23
0
def edit(message_id):
    user = auth.get_logged_in_user()
    message = get_object_or_404(Message, user=user, id=message_id)
    if request.method == 'POST' and request.form['content']:
        message.content = request.form['content']
        message.save()
        flash('Your changes were saved')
        return redirect(url_for('user_detail', username=user.username))

    return render_template('edit.html', message=message)
예제 #24
0
def note_edit(noteid):
    user = auth.get_logged_in_user()  # Logged In User
    note = get_object_or_404(Note, Note.user == user, Note.id == noteid)
    if request.method == 'POST' and request.form['message']:
        note.message = request.form['message']
        note.title = request.form['title']
        note.save()
        flash('Thanks! You updated the data!')
        return redirect(url_for('note_list'))
    return render_template('note_edit.html', note=note)
예제 #25
0
파일: views.py 프로젝트: RustyDust/backend
def start():
    # Determine whether user is logged in and redirect if not
    me = auth.get_logged_in_user()
    if me:
        if me.username == 'admin' or me.admin:
            return show_userlist()
        else:
            return show_user_devices(me.username)
    else:
        return render_template('welcome.html')
예제 #26
0
파일: views.py 프로젝트: sekenned/totb
def edit(message_id):
    user = auth.get_logged_in_user()
    message = get_object_or_404(Message, Message.user == user, Message.id == message_id)
    if request.method == "POST" and request.form["content"]:
        message.content = request.form["content"]
        message.save()
        flash("Your changes were saved")
        return redirect(url_for("user_detail", username=user.username))

    return render_template("edit.html", message=message)
예제 #27
0
파일: views.py 프로젝트: coderluka/naucilus
def edit(message_id):
    user = auth.get_logged_in_user()
    message = get_object_or_404(Message, Message.user==user, Message.id==message_id)
    if request.method == 'POST' and request.form['content']:
        message.content = request.form['content']
        message.save()
        flash('Your changes were saved')
        return redirect(url_for('user_detail', username=user.username))

    return render_template('edit.html', message=message)
예제 #28
0
파일: views.py 프로젝트: wikty/bookmark
def bookmark():
    user = auth.get_logged_in_user()
    # object_list automatically invoke PaginateQuery
    # capture request.args.get('page') to calucalte pagination
    bookmarks = user.Bookmarks
    return object_list('bookmark_list.html',
                        bookmarks,
                        'bookmarks',
                        paginate_by=PERPAGE,
                        user=user)
예제 #29
0
def getNotes(note_id=None):
    user = auth.get_logged_in_user()
    notes = Note.select().where(Note.user == user).order_by(
        Note.created_date.desc())
    context = {
        'notes': notes,
    }
    if note_id:
        note = get_object_or_404(Note, Note.user == user, Note.id == note_id)
        context['note'] = note
    return render_template('notes.html', context=context)
예제 #30
0
def create():
    user = auth.get_logged_in_user()
    if request.method == 'POST' and request.form["content"]:
        Note.create(
            user=user,
            content=request.form["content"],
        )
        flash('Your note has been created')
        return redirect(url_for('getNotes'))

    return render_template('create.html')
예제 #31
0
파일: views.py 프로젝트: jeffca/recipes
def create():
    user = auth.get_logged_in_user()
    if request.method == 'POST' and request.form['content']:
        message = Message.create(
            user=user,
            content=request.form['content'],
        )
        flash('Your message has been created')
        return redirect(url_for('user_detail', username=user.username))

    return render_template('create.html')
예제 #32
0
파일: views.py 프로젝트: coderluka/naucilus
def create():
    user = auth.get_logged_in_user()
    if request.method == 'POST' and request.form['content']:
        message = Message.create(
            user=user,
            content=request.form['content'],
        )
        flash('Your post has been created')
        return redirect(url_for('user_detail', username=user.username))

    return render_template('create.html')
예제 #33
0
파일: views.py 프로젝트: coderluka/naucilus
def private_timeline():
    user = auth.get_logged_in_user()

    messages = Message.select().where(Message.user << user.following()).order_by(Message.pub_date.desc())
    return object_list('profile.html',
			messages,
			'message_list',
			course_1_name='jhdsjhdjs',
			progress='50',
			course_1_description='opis opis opis',
			)
예제 #34
0
파일: views.py 프로젝트: carfriends/odin
def update_score(user_id,score_id):
    with db.database.transaction():
        score = get_object_or_404(Score, Score.id == score_id)
        ensure(EDIT,score)
        score.rater = auth.get_logged_in_user()
        score.score = request.form.get("score")
        score.memo = request.form.get("memo")
        score.save()
        ScoreHistory.create(
            rater = auth.get_logged_in_user(),
            score = score,
            history = request.form.get("score")
            )
        Score.get_or_create(
            user = g.user,
            week = score.week,
            week_start = score.week_start,
            week_end = score.week_end
            )
    return redirect(url_for('user_detail',user_id=user_id))
예제 #35
0
def ship():
	user = auth.get_logged_in_user()
	#book = get_object_or_404(Books, Books.user == user, Books.id)
	if request.method == "POST":
		book_id = request.form["book_id"]
		b = Books.delete().where(Books.ownership == user and Books.id == book_id)
		b.execute()
		return render_template("shipped.html")
	else:
		print "wtf"
		return redirect(url_for("dashboard"))
예제 #36
0
def note_add():
    if request.method == 'POST' and request.form['message']:
        user = auth.get_logged_in_user()
        message = Note.create(
            user=user,
            message=request.form['message'],
            title=request.form['title'],
        )
        message.save()
        flash('You submited data!')
        return redirect(url_for('note_list'))
    return render_template('note_add.html')
예제 #37
0
파일: views.py 프로젝트: wikty/bookmark
def index():
    user = auth.get_logged_in_user()
    if user:
        return redirect(url_for('bookmark'))
    else:
        # random pick 30 bookmarks, If Database is MySQL, please use fn.Rand()
        # fn come from, from peewee import *
        bookmarks = Bookmark.select().order_by(fn.Random()).limit(PERPAGE)
        return object_list('bookmark_list.html',
                            bookmarks,
                            'bookmarks',
                            paginate_by=PERPAGE)
예제 #38
0
파일: views.py 프로젝트: sekenned/totb
def update(username):
    user = auth.get_logged_in_user()
    username = user.username
    if request.method == "POST" and request.form["username"]:
        if request.form["old_password"] == user.check_password():
            user.set_password(request.form["new_password"])
            user.save()
            flash("Your changes were saved")
            return redirect(url_for("user_detail", username=user.username))
        else:
            return redirect(url_for("update"))

    return render_template("update.html")
예제 #39
0
def private_timeline():
    user = auth.get_logged_in_user()

    messages = Message.select().where(
        Message.user << user.following()).order_by(Message.pub_date.desc())
    return object_list(
        'profile.html',
        messages,
        'message_list',
        course_1_name='jhdsjhdjs',
        progress='50',
        course_1_description='opis opis opis',
    )
예제 #40
0
파일: views.py 프로젝트: Jovan3211/naucilus
def private_timeline():
    user = auth.get_logged_in_user()
    messages = Message.select().where(Message.user << user.following()).order_by(Message.pub_date.desc())
    return object_list('profile.html',
			messages,
			'message_list',
			ps_nr_points=' 57',
			ps_nr_badges=' 5',
			html_nr_points=' 77',
			html_nr_badges=' 3',
			py_nr_points=' 77',
			py_nr_badges=' 3',
			usersname=user,
			)
예제 #41
0
def login():
    if request.method == 'POST':
        try:
            user = User().select().where(
                User.username == request.form['username']).get()
            if user.check_password(request.form['password']):
                auth.login_user(user)
                return getNotes()
        except Exception:
            pass

    elif request.method == 'GET':
        if auth.get_logged_in_user():
            return redirect(url_for('getNotes'))
    return render_template('login.html')
예제 #42
0
def ajax_create_hackathon():
    hack = Hackathon()

    form = HackathonForm(request.form)
    if form.validate():
        form.populate_obj(hack)
        hack.owner = auth.get_logged_in_user()
        data = urllib.urlencode({
            'access_token':
            session["fb_token"],
            'name':
            hack.title,
            'start_time':
            datetime.date.isoformat(hack.start_date),
            'end_time':
            datetime.date.isoformat(hack.end_date),
            'description':
            hack.description,
            'location':
            hack.location
        })
        print "data is ", data
        req = urllib2.Request(
            "https://graph.facebook.com/" + str(hack.owner.facebook_id) +
            "/events", data)
        response = urllib2.urlopen(req)
        decoder = JSONDecoder()
        hack.facebook_id = decoder.decode(response.read())["id"]
        trivia_str = ""
        for question in trivia_info:
            trivia_str += question + "|" + trivia_info[question] + "\n"

        trivia_str = trivia_str[:-1]

        hack.cur_question = trivia_str.split("\n")[0]
        hack.trivia = trivia_str

        hack.save()
        return {"hackathon_id": hack.id}

    else:
        for field in form:
            print field.label
            for error in field.errors:
                print error
        return {"status": "error", "error": "DERP"}
예제 #43
0
파일: views.py 프로젝트: wikty/bookmark
def bookmark_remove(id):
    user = auth.get_logged_in_user()
    bookmark = {}
    try:
        bookmark = Bookmark.get(Bookmark.id == id)
    except Bookmark.DoesNotExist:
        flash(u'你要删除的书签不存在', 'error')
        return redirect(url_for('page_404'))
    
    if request.method == 'POST':
        with db.database.transaction():
            bookmark.destory_image()
            bookmark.delete_instance(recursive=True)
            flash(u'你刚刚删除了一个书签', 'success')
            return redirect(url_for('bookmark'))
    
    return render_template('bookmark_remove.html', bookmark=bookmark, user=user)
예제 #44
0
def book_add(msg = ""):
	book_form = BookForm(request.form)
	user = auth.get_logged_in_user()
	if request.method == "POST":
		books = Books(
			ownership = user,
			title = book_form.title.data,
			author = book_form.author.data,
			isbn = book_form.isbn.data,
		)
		books.save()
		flash("Book successfully saved")
		msg = "Book successfully saved"
		book_form = BookForm()
		return render_template("book_add.html", book_form=book_form, msg=msg)
	else:
		return render_template("book_add.html", book_form=book_form, msg=msg)		
예제 #45
0
def before_request():
    """
    Executed before processing every request.

    It performs common initialization actions needed for every request,
    like opening database connections, creating temporary files
    or loading the current user basic information.
    Note: The database connection is 'automagically' open by Flask-Peewee.
    """
    #
    # Config the database.
    #
    g.db = db
    g.db.set_autocommit(False)

    # Load the current user info:
    g.user = auth.get_logged_in_user()
예제 #46
0
def before_request():
    """
    Executed before processing every request.

    It performs common initialization actions needed for every request,
    like opening database connections, creating temporary files
    or loading the current user basic information.
    Note: The database connection is 'automagically' open by Flask-Peewee.
    """
    #
    # Config the database.
    #
    g.db = db
    g.db.set_autocommit(False)

    # Load the current user info:
    g.user = auth.get_logged_in_user()
예제 #47
0
def address():
	address_form = AddressForm(request.form)
	user = auth.get_logged_in_user()
	address = get_object_or_404(Address, Address.user == user)
	if request.method == "POST":
		address = address.update(
			street=request.form["street"],
			zipcode=request.form["zipcode"],
			state=request.form["state"],
			country=request.form["country"]).where(address.user == user)
		address.execute()
		flash("Address successfully saved")
		return redirect(url_for("dashboard"))
	elif request.method =="GET":
		street = address.street
		zipcode = address.zipcode
		state = address.state
		country = address.country
		return render_template("address.html", street=street, zipcode=zipcode, state=state, country=country, address_form=address_form)
예제 #48
0
def ajax_create_hackathon():
	hack = Hackathon()

	form = HackathonForm(request.form)
	if form.validate():
		form.populate_obj(hack)
		hack.owner = auth.get_logged_in_user()
		data = urllib.urlencode({
				'access_token' : session["fb_token"],
				'name' : hack.title,
				'start_time' : datetime.date.isoformat(hack.start_date),
				'end_time' : datetime.date.isoformat(hack.end_date),
				'description' : hack.description,
				'location' : hack.location})
		print "data is " , data
		req = urllib2.Request("https://graph.facebook.com/"+str(hack.owner.facebook_id)+"/events", data)
		response = urllib2.urlopen(req)
		decoder = JSONDecoder()
		hack.facebook_id = decoder.decode(response.read())["id"]
		trivia_str = ""
		for question in trivia_info:
			trivia_str += question + "|" + trivia_info[question] + "\n"

		trivia_str = trivia_str[:-1]

		hack.cur_question = trivia_str.split("\n")[0]
		hack.trivia = trivia_str

		hack.save()
		return {"hackathon_id": hack.id}

	else:
		for field in form:
			print field.label
			for error in field.errors:
				print error
		return {"status": "error", "error": "DERP"}
예제 #49
0
def note_list():
    user = auth.get_logged_in_user()
    notes = Note.select().where(Note.user == user).order_by(
        Note.created.desc())
    return object_list('note_list.html', notes, 'notes')
예제 #50
0
def note_view(noteid):
    user = auth.get_logged_in_user()  # Logged In User
    note = get_object_or_404(Note, Note.id == noteid, Note.user == user)
    return render_template('note_view.html', note=note)
예제 #51
0
def private_timeline():
    user = auth.get_logged_in_user()
    return 'PRIVATE!'
예제 #52
0
def ajax_post_shoutout():
    hackathon = get_object_or_404(Hackathon, id=request.form["hackathon_id"])
    so = Shoutout(user=auth.get_logged_in_user(),
                  hackathon=hackathon,
                  message=request.form["message"])
    so.save()
예제 #53
0
def private_view():
    user = auth.get_logged_in_user()
    return render_tempate(...)
예제 #54
0
def delete_entry(note_id):
    user = auth.get_logged_in_user()
    note = get_object_or_404(Note, Note.user == user, Note.id == note_id)

    note.delete_instance()
    return redirect(url_for('getNotes'))
예제 #55
0
def homepage():
    if auth.get_logged_in_user():
        return redirect(url_for('getNotes'))
    else:
        return render_template("homepage.html")
예제 #56
0
파일: views.py 프로젝트: jeffca/recipes
def followers():
    user = auth.get_logged_in_user()
    return object_list('user_followers.html', user.followers(), 'user_list')
예제 #57
0
파일: views.py 프로젝트: jeffca/recipes
def homepage():
    if auth.get_logged_in_user():
        return private_timeline()
    else:
        return public_timeline()
예제 #58
0
def index():
    if auth.get_logged_in_user() is None:
        return redirect(url_for("login"))
    # maybe a small dashboard?
    info = c.info()
    return render_template("index.html", info=info)