This commit is contained in:
sahama 2024-08-05 14:25:37 +03:30
parent c86866611a
commit 307ac359a2
3 changed files with 15 additions and 13 deletions

View file

@ -27,6 +27,7 @@ SECRET_KEY = 'django-insecure-&+7fi$8#2!r=b6=^i_6surhka6!%uw1a+pz^m0qc!t_#6y=qr2
DEBUG = config('DEBUG', default=True, cast=bool) DEBUG = config('DEBUG', default=True, cast=bool)
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
PAGE_SIZE = 20
# Application definition # Application definition
@ -107,7 +108,7 @@ REST_FRAMEWORK = {
'rest_framework.permissions.IsAuthenticated', 'rest_framework.permissions.IsAuthenticated',
), ),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 10, 'PAGE_SIZE': PAGE_SIZE,
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema", "DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
} }

View file

@ -1,3 +1,4 @@
from django.conf import settings
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.urls import resolve, reverse_lazy from django.urls import resolve, reverse_lazy
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
@ -54,7 +55,7 @@ class ApplicationDetailView(DetailView):
class ApplicationListView(FilterMixin, ListView): class ApplicationListView(FilterMixin, ListView):
model = Application model = Application
template_name = "gooyal_oauth2/application_list.html" template_name = "gooyal_oauth2/application_list.html"
paginate_by = 2 paginate_by = settings.PAGE_SIZE
filterset_class = ApplicationFilter filterset_class = ApplicationFilter
def get_ordering(self): def get_ordering(self):

View file

@ -12,7 +12,7 @@
<div class="me-2"> <div class="me-2">
<a href="{% url 'gooyal_oauth2:application_create' %}"> <a href="{% url 'gooyal_oauth2:application_create' %}">
<div class="btn btn-success"> <div class="btn btn-success">
<span class="bi bi-info-circle-fill"></span> <span class="bi bi-plus-circle-fill"></span>
</div> </div>
</a> </a>
</div> </div>
@ -23,8 +23,8 @@
{% block content %} {% block content %}
<table class="table"> <table class="table">
<tr> <tr>
<th><a href="?{% get_filter_link request 'ordering' 'name' %}" >name{% if request.GET.ordering and 'name' in request.GET.ordering %}<i class="bi bi-arrow-down"></i>{% endif %}</a></th> <th><a href="?{% get_filter_link request 'ordering' 'name' %}" >name{% if request.GET.ordering and 'name' in request.GET.ordering %}<i class="bi bi-arrow-down-short"></i>{% endif %}</a></th>
<th><a href="?{% get_filter_link request 'ordering' 'client_id' %}" >client id{% if request.GET.ordering and 'client_id' in request.GET.ordering %}<i class="bi bi-arrow-down"></i>{% endif %}</a></th> <th><a href="?{% get_filter_link request 'ordering' 'client_id' %}" >client id{% if request.GET.ordering and 'client_id' in request.GET.ordering %}<i class="bi bi-arrow-down-short"></i>{% endif %}</a></th>
<th>actions</th> <th>actions</th>
</tr> </tr>
{% for obj in object_list %} {% for obj in object_list %}
@ -37,17 +37,17 @@
<div class="me-2"> <div class="me-2">
<a href="{% url 'gooyal_oauth2:application_detail' pk=obj.pk %}"> <a href="{% url 'gooyal_oauth2:application_detail' pk=obj.pk %}">
<div class="btn btn-success"> <div class="btn btn-success">
<span class="bi bi-info-circle-fill"></span> <span class="bi bi-gear-fill"></span>
</div>
</a>
</div>
<div class="me-2">
<a href="{% url 'gooyal_oauth2:application_update' pk=obj.pk %}">
<div class="btn btn-success">
<span class="bi bi-info-circle-fill"></span>
</div> </div>
</a> </a>
</div> </div>
{# <div class="me-2">#}
{# <a href="{% url 'gooyal_oauth2:application_update' pk=obj.pk %}">#}
{# <div class="btn btn-success">#}
{# <span class="bi bi-info-circle-fill"></span>#}
{# </div>#}
{# </a>#}
{# </div>#}
</div> </div>
</div> </div>
</td> </td>