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 = [
|
||||
'web.apps.WebConfig',
|
||||
'bootstrap4',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
|
@ -124,6 +125,7 @@ STATIC_URL = '/static/'
|
|||
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
|
||||
GITHUB_REQUEST_TIMEOUT = 10
|
||||
|
||||
# Default search settings
|
||||
# Search settings
|
||||
DEFAULT_LIMIT = 5
|
||||
DEFAULT_QUERY = 'Dependency Injector'
|
||||
LIMITS = [5, 10, 20]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
dependency-injector
|
||||
django
|
||||
django-bootstrap4
|
||||
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">
|
||||
<h1 class="mb-4">Github Navigator</h1>
|
||||
|
||||
|
@ -61,3 +66,4 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,3 +1,7 @@
|
|||
"""Views module."""
|
||||
|
||||
from typing import List
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.shortcuts import render
|
||||
from dependency_injector.wiring import Provide
|
||||
|
@ -11,6 +15,7 @@ def index(
|
|||
search_service: SearchService = Provide[Container.search_service],
|
||||
default_query: str = Provide[Container.config.DEFAULT_QUERY],
|
||||
default_limit: int = Provide[Container.config.DEFAULT_LIMIT.as_int()],
|
||||
limits: List[int] = Provide[Container.config.LIMITS],
|
||||
) -> HttpResponse:
|
||||
query = request.GET.get('query', default_query)
|
||||
limit = int(request.GET.get('limit', default_limit))
|
||||
|
@ -23,7 +28,7 @@ def index(
|
|||
context={
|
||||
'query': query,
|
||||
'limit': limit,
|
||||
'limits': [5, 10, 20],
|
||||
'limits': limits,
|
||||
'repositories': repositories,
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user