mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-07 07:00:49 +03:00
Add bootstrap 4
This commit is contained in:
parent
020fe141dd
commit
b56707deeb
|
@ -32,6 +32,7 @@ ALLOWED_HOSTS = []
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
'web.apps.WebConfig',
|
'web.apps.WebConfig',
|
||||||
|
'bootstrap4',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
@ -124,6 +125,7 @@ STATIC_URL = '/static/'
|
||||||
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
|
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
|
||||||
GITHUB_REQUEST_TIMEOUT = 10
|
GITHUB_REQUEST_TIMEOUT = 10
|
||||||
|
|
||||||
# Default search settings
|
# Search settings
|
||||||
DEFAULT_LIMIT = 5
|
DEFAULT_LIMIT = 5
|
||||||
DEFAULT_QUERY = 'Dependency Injector'
|
DEFAULT_QUERY = 'Dependency Injector'
|
||||||
|
LIMITS = [5, 10, 20]
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
dependency-injector
|
dependency-injector
|
||||||
django
|
django
|
||||||
|
django-bootstrap4
|
||||||
pygithub
|
pygithub
|
||||||
|
|
10
examples/miniapps/django/web/templates/base.html
Normal file
10
examples/miniapps/django/web/templates/base.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{% extends 'bootstrap4/bootstrap4.html' %}
|
||||||
|
|
||||||
|
{% load bootstrap4 %}
|
||||||
|
|
||||||
|
{% block bootstrap4_title %}{% block title %}{% endblock %}{% endblock %}
|
||||||
|
|
||||||
|
{% block bootstrap4_content %}
|
||||||
|
{% autoescape off %}{% bootstrap_messages %}{% endautoescape %}
|
||||||
|
{% block content %}(no content){% endblock %}
|
||||||
|
{% endblock %}
|
|
@ -1,3 +1,8 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Github Navigator{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1 class="mb-4">Github Navigator</h1>
|
<h1 class="mb-4">Github Navigator</h1>
|
||||||
|
|
||||||
|
@ -61,3 +66,4 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -1,3 +1,7 @@
|
||||||
|
"""Views module."""
|
||||||
|
|
||||||
|
from typing import List
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from dependency_injector.wiring import Provide
|
from dependency_injector.wiring import Provide
|
||||||
|
@ -11,6 +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],
|
||||||
) -> 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))
|
||||||
|
@ -23,7 +28,7 @@ def index(
|
||||||
context={
|
context={
|
||||||
'query': query,
|
'query': query,
|
||||||
'limit': limit,
|
'limit': limit,
|
||||||
'limits': [5, 10, 20],
|
'limits': limits,
|
||||||
'repositories': repositories,
|
'repositories': repositories,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user