def home(): dosens = (User.select(User, MataKuliah) .join(MataKuliah) .join(Level, JOIN.LEFT_OUTER, on=(User.level == Level.id)) .join(Tugas, JOIN.LEFT_OUTER, on=(Tugas.mata_kuliah == MataKuliah.id)) .join(Profile, on=(User.profile == Profile.id)) .group_by(User) .where(Level.name == 'dosen') .order_by(Profile.nama.asc())) dosen_id = request.args.get('dosen_id', None) if dosen_id: dosen = dosens.filter(User.id == dosen_id).get() else: dosen = dosens.first() dosen_id = dosen.id posts = Post.select().order_by(Post.id.desc()) user = g.user return render_template('mhs/home.html', dosen=dosen, dosens=dosens, posts=posts, dosen_id=dosen_id)
def home(): posts = Post.select().where(Post.publik == True) return object_list('home.html', posts, var_name='posts')
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)