Update django app naming

This commit is contained in:
Roman Mogylatov 2020-10-05 14:53:39 -04:00
parent 6094186063
commit 361858950f
4 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
"""Main package.""" """Project package."""
from .containers import Container from .containers import Container
from . import settings from . import settings

View File

@ -128,4 +128,4 @@ GITHUB_REQUEST_TIMEOUT = 10
# Search settings # Search settings
DEFAULT_LIMIT = 5 DEFAULT_LIMIT = 5
DEFAULT_QUERY = 'Dependency Injector' DEFAULT_QUERY = 'Dependency Injector'
LIMITS = [5, 10, 20] LIMIT_OPTIONS = [5, 10, 20]

View File

@ -22,7 +22,7 @@
Limit: Limit:
</label> </label>
<select class="form-control" id="search_limit" name="limit"> <select class="form-control" id="search_limit" name="limit">
{% for value in limits %} {% for value in limit_options %}
<option {% if value == limit %}selected{% endif %}> <option {% if value == limit %}selected{% endif %}>
{{ value }} {{ value }}
</option> </option>

View File

@ -15,7 +15,7 @@ def index(
search_service: SearchService = Provide[Container.search_service], search_service: SearchService = Provide[Container.search_service],
default_query: str = Provide[Container.config.DEFAULT_QUERY], default_query: str = Provide[Container.config.DEFAULT_QUERY],
default_limit: int = Provide[Container.config.DEFAULT_LIMIT.as_int()], default_limit: int = Provide[Container.config.DEFAULT_LIMIT.as_int()],
limits: List[int] = Provide[Container.config.LIMITS], limit_options: List[int] = Provide[Container.config.LIMIT_OPTIONS],
) -> HttpResponse: ) -> HttpResponse:
query = request.GET.get('query', default_query) query = request.GET.get('query', default_query)
limit = int(request.GET.get('limit', default_limit)) limit = int(request.GET.get('limit', default_limit))
@ -28,7 +28,7 @@ def index(
context={ context={
'query': query, 'query': query,
'limit': limit, 'limit': limit,
'limits': limits, 'limit_options': limit_options,
'repositories': repositories, 'repositories': repositories,
} }
) )