def tags(tag): """ shows the projects for the tag. """ top_tag_counts = top_tags(current_session) per_page = 30 start = int(request.args.get('start', 0)) prev_start = start - per_page if prev_start < 0: prev_start = None next_start = start + per_page # all is a special tag, meaning show all. if tag == 'all': projectsq = ( current_session.query(Project).join(User).join(Release).filter( Release.project_id == Project.id).filter( User.id == Project.users_id).filter( User.disabled == 0).order_by( Release.datetimeon.desc())) else: projectsq = ( current_session.query(Project).join(User).join(Tags).filter( User.id == Project.users_id).filter(User.disabled == 0).filter( Tags.project_id == Project.id).filter(Tags.value == tag)) projects = (projectsq.offset(start).limit(per_page).all()) return render_template('project/tags.html', tag=tag, tags=tags, top_tag_counts=top_tag_counts, projects=inchunks(projects, 3), prev_start=prev_start, next_start=next_start)
def all_tags(): """ On this view we list ALL the tags. """ tag_counts = top_tags(current_session, limit=None) return render_template('project/tags_view.html', tag_counts=tag_counts, title='Tags')
def sidebar(): """ called by template in base.html sidebar block. """ top_tag_counts = top_tags(current_session) recent_releases = (current_session.query( User, Project, Release).filter(Release.project_id == Project.id).filter( User.id == Project.users_id).filter(User.disabled == 0).order_by( Release.datetimeon.desc()).limit(10).all()) return dict(top_tag_counts=top_tag_counts, recent_releases=recent_releases)
def sidebar(): """ called by template in base.html sidebar block. """ return dict( top_tag_counts=top_tags(current_session), recent_releases=(recent_releases(current_session).limit(10).all()))