python-dependency-injector/examples/miniapps/ghnav-flask/githubnavigator/views.py
Roman Mogylatov 1674cecc8d
Flask tutorial (#265)
* Add a piece of the tutorial

* Add "Make it pretty" tutorial step

* Add section about github client setup

* Make minor fixes

* Add search service section + table of contents

* Make various fixes

* Make more fixes

* Update make the search section

* Update ghnav-flask example & README

* Update base.html markup

* Finish section: Make the search work

* Update ghnav-flask screenshot

* Update tutorials

* Add flaks tutorial link to the DI in Python page
2020-07-20 16:58:18 -04:00

24 lines
526 B
Python

"""Views module."""
from flask import request, render_template
from .services import SearchService
def index(
search_service: SearchService,
default_query: str,
default_limit: int,
):
query = request.args.get('query', default_query)
limit = request.args.get('limit', default_limit, int)
repositories = search_service.search_repositories(query, limit)
return render_template(
'index.html',
query=query,
limit=limit,
repositories=repositories,
)