Example #1
0
def user_detail(username):
    user = get_object_or_404(User, username=username)
    messages = user.message_set.order_by(('pub_date', 'desc'))
    return object_list('user_detail.html',
                       messages,
                       'message_list',
                       person=user)
Example #2
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')
Example #3
0
def update_db():
    url = 'http://www.unisport.dk/api/sample/'
    request = urlopen(url)
    response = request.read()
    j = json.loads(response)  #Parsing all data from response
    data_list = j['latest']  #Getting list of dicts
    #Updating our database
    query = Products.delete()
    query.execute()
    for item in data_list:
        product = Products()
        product.kids = item['kids']
        product.name = item['name']
        product.sizes = item['sizes']
        product.k_adalt = item['kid_adult']
        product.free_porto = item['free_porto']
        product.price = item['price'].replace(',', '.')
        product.package = item['package']
        product.delivery = item['delivery']
        product.url = item['url']
        product.price_old = item['price_old'].replace(',', '.')
        product.img_url = item['img_url']
        product.product_id = item['id']
        product.women = item['women']
        product.save()
#After our database was successfully updated we
#return results paginated by 10 products per page
    return object_list('products.html', Products.select(), paginate_by=10)
Example #4
0
def user_detail(username):
    user = get_object_or_404(User, User.username == username)
    messages = user.message_set.order_by(Message.pub_date.desc())
    return object_list('user_detail.html',
                       messages,
                       'message_list',
                       person=user)
Example #5
0
def image_timeline():

    """
        function that is called when the url for images
        is being requested
    """
    images = Image.select().order_by(('id', 'asc'))
    return object_list('images.html', images, 'image_list')
Example #6
0
File: views.py Project: lite/pinche
def private_timeline():
    user = auth.get_logged_in_user()

    messages = Message.select().where(
        user__in=user.following()
    ).order_by(('pub_date', 'desc'))

    return object_list('private_messages.html', messages, 'message_list')
Example #7
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)
Example #8
0
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)
Example #9
0
def tugas_list():
    tugass = (
    Tugas.select(Tugas, fn.Count(KumpulTugas.id).alias('k_tugas_count'))
    .join(KumpulTugas, JOIN.LEFT_OUTER, on=(KumpulTugas.tugas == Tugas.id))
    .join(MataKuliah, on=(Tugas.mata_kuliah == MataKuliah.id))
    .group_by(Tugas)
    .where(MataKuliah.dosen == current_user()))

    return object_list('dosen/tugas/list.html', tugass, var_name='tugass',
                       paginate_by=10)
Example #10
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',
			)
Example #11
0
def model(vendor, model):
    """ View informations for a model for one vendor """
    m = Models()
    model_infos = m.get_model(model)
    comment = comments.select().where(comments.model == model)
    return object_list('model.html',
                       comment,
                       'comment_list',
                       vendor=vendor,
                       model=model,
                       model_infos=model_infos)
Example #12
0
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)
Example #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(
        'profile.html',
        messages,
        'message_list',
        course_1_name='jhdsjhdjs',
        progress='50',
        course_1_description='opis opis opis',
    )
Example #14
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',
			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,
			)
Example #15
0
def matkul_list():
    matkuls = MataKuliah.select().order_by(MataKuliah.kode.desc())
    return object_list('admin/matkul/list.html', matkuls, var_name='matkuls',
                       paginate_by=10)
Example #16
0
def user_list():
    users = User.select().order_by(User.username)
    return object_list("user_list.html", users, "user_list")
Example #17
0
def city_list():
    obj_list = City.select().order_by('name')
    return object_list('city_list.html', obj_list, "obj_list")
Example #18
0
def public_timeline():
    news_list = OursNews.select().order_by('score')
    return object_list('index.html', news_list, "news_list")
Example #19
0
def public_timeline():
    messages = Message.select().order_by(Message.pub_date.desc())
    return object_list("timeline.html", messages, "message_list")
Example #20
0
File: views.py Project: lite/pinche
def public_timeline():
    messages = Message.select().order_by(('pub_date', 'desc'))
    return object_list('public_messages.html', messages, 'message_list')
Example #21
0
File: views.py Project: lite/pinche
def user_detail(username):
    user = get_object_or_404(User, username=username)
    messages = user.message_set.order_by(('pub_date', 'desc'))
    return object_list('user_detail.html', messages, 'message_list', person=user)
Example #22
0
File: user.py Project: ap13p/elearn
def user_list():
    users = User.select()
    _level = request.args.get('level', None)
    if _level:
        users = users.join(Level).where(Level.name == _level)
    return object_list('admin/user/list.html', users, 'users', paginate_by=10)
Example #23
0
def city_detail(city_id):
    city = get_object_or_404(City, id=city_id)
    obj_list = Pinche.select().where(city=city).order_by('pub_date')
    return object_list('city_detail.html', obj_list, "obj_list")
Example #24
0
def public_timeline():
    messages = Message.select().order_by(Message.pub_date.desc())
    return object_list('public_messages.html', messages, 'message_list')
Example #25
0
def user_list():
    users = User.select().order_by(User.username)
    return object_list('user_list.html', users, 'user_list')
Example #26
0
def homepage():
    stories = Story.select()
    return object_list('homepage.html', stories, 'stories')
Example #27
0
def user_list():
    users = User.select().order_by(User.username)
    return object_list('user_list.html', users, 'user_list')
Example #28
0
def followers():
    user = auth.get_logged_in_user()
    return object_list('user_followers.html', user.followers(), 'user_list')
Example #29
0
def index():
    return object_list('index.html', Bookmark.select())
Example #30
0
File: post.py Project: ap13p/elearn
def post_list():
    posts = Post.select().order_by(Post.date_created.desc())
    return object_list('admin/post/list.html', posts, var_name='posts',
                       paginate_by=10)
Example #31
0
File: views.py Project: giskar/shop
def goods_list():

    goods = Goods.select()
    return object_list('goods_list.html', goods, 'goods_list')
Example #32
0
def pinche_list():
    obj_list = Pinche.select().order_by('pub_date')
    return object_list('pinche_list.html', obj_list, "obj_list")
Example #33
0
def following():
    user = auth.get_logged_in_user()
    return object_list('user_following.html', user.following(), 'user_list')
Example #34
0
File: views.py Project: lite/pinche
def city_list():
    obj_list = City.select().order_by('name')
    return object_list('city_list.html', obj_list, "obj_list")
Example #35
0
def user_detail(username):
    user = get_object_or_404(User, User.username==username)
    messages = user.message_set.order_by(Message.pub_date.desc())
    return object_list('user_detail.html', messages, 'message_list', person=user)
Example #36
0
File: views.py Project: lite/pinche
def city_detail(city_id):
    city = get_object_or_404(City, id=city_id)
    obj_list = Pinche.select().where(city=city).order_by('pub_date')
    return object_list('city_detail.html', obj_list, "obj_list")
Example #37
0
def public_timeline():
    messages = Message.select().order_by(Message.pub_date.desc())
    return object_list('forum.html', messages, 'message_list')
Example #38
0
File: views.py Project: lite/pinche
def pinche_list():
    obj_list = Pinche.select().order_by('pub_date')
    return object_list('pinche_list.html', obj_list, "obj_list")
Example #39
0
def home():
    posts = Post.select().where(Post.publik == True)
    return object_list('home.html', posts, var_name='posts')
Example #40
0
def public_timeline():
    userf = auth.get_logged_in_user()
    messages = Message.select().order_by(Message.pub_date.desc())
    return object_list('forum.html', messages, 'message_list', forumusername=userf, forumname='The Forum Wall',)