From 7d80372bace5acc0ead76f96a98c37d6e27f4598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=20=D0=9E=D0=BB=D1=8C=D0=B3=D0=B0?= Date: Thu, 27 May 2021 17:47:40 +0300 Subject: [PATCH 1/5] Add autodoc-process-signature to sphinx.events --- docs/source/conf.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index b4be21c..5a7ba38 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,11 +11,15 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os +import sphinx.events import sys import inspect import enchant import django + +sphinx.events.core_events['autodoc-process-signature'] = '' + sys.path.insert(0, os.path.abspath('../../')) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'access_controller.settings') @@ -47,6 +51,8 @@ author = 'SHP S101, group 2' release = 'v0.01' + + # -- General configuration --------------------------------------------------- def process_django_models(app, what, name, obj, options, lines): @@ -112,8 +118,9 @@ def skip_queryset(app, what, name, obj, skip, options): return skip -def fix_sig(app, what, name, obj, options, signature, return_annotation): - return "", "" +def process_signature(app, what: str, name: str, obj, options, signature, return_annotation): + if not callable(obj): + return def setup(app): @@ -121,7 +128,7 @@ def setup(app): app.connect('autodoc-process-docstring', process_django_models) app.connect('autodoc-skip-member', skip_queryset) app.connect('autodoc-process-docstring', process_modules) - app.connect("autodoc-process-signature", fix_sig) + app.connect("autodoc-process-signature", process_signature) # Add any Sphinx extension module names here, as strings. They can be From f19d9a504aea344a204be3e645e776547d873b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=20=D0=9E=D0=BB=D1=8C=D0=B3=D0=B0?= Date: Fri, 28 May 2021 18:51:52 +0300 Subject: [PATCH 2/5] First step to create button for doc --- access_controller/urls.py | 3 +- main/templates/base/menu.html | 3 + main/templates/pages/documentation.html | 252 ++++++++++++++++++++++++ main/views.py | 7 + 4 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 main/templates/pages/documentation.html diff --git a/access_controller/urls.py b/access_controller/urls.py index 58864d0..74e5cd2 100644 --- a/access_controller/urls.py +++ b/access_controller/urls.py @@ -17,7 +17,7 @@ from django.contrib import admin from django.urls import path, include from main.urls import router -from main.views import main_page, profile_page, CustomRegistrationView, CustomLoginView, registration_error +from main.views import main_page, profile_page, CustomRegistrationView, CustomLoginView, registration_error, docs_page from main.views import registration_failed from main.views import work_page, work_hand_over, work_become_engineer, work_get_tickets, \ AdminPageView, statistic_page @@ -39,6 +39,7 @@ urlpatterns = [ path('registration_failed/', registration_failed, name='registration_failed'), path('control/', AdminPageView.as_view(), name='control'), path('statistic/', statistic_page, name='statistic'), + path('documentation/', docs_page, name='documentation') ] # Django REST diff --git a/main/templates/base/menu.html b/main/templates/base/menu.html index 17c5f81..6ec7ab1 100644 --- a/main/templates/base/menu.html +++ b/main/templates/base/menu.html @@ -59,6 +59,9 @@ class="btn btn-secondary" {% endif %} href="{{ registration_url }}">Зарегистрироваться + {% url 'documentation' as documentation_url %} + Документация {% endif %} diff --git a/main/templates/pages/documentation.html b/main/templates/pages/documentation.html new file mode 100644 index 0000000..6e3629b --- /dev/null +++ b/main/templates/pages/documentation.html @@ -0,0 +1,252 @@ + + + + + + + + + + Документация контроллера прав доступа — документация ZenDesk Access Controller v0.01 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + + + ZenDesk Access Controller + + + + + + + + + + + +
+
+ + + +
+
+ + +
+ + +
+ + + + + + +

Contents:

+
    +
  • Документация пользователя
  • +
  • Документация разработчика
  • +
  • READ.me
  • +
  • Что необходимо доделать?
  • +
+ + + +
+ +
+
+ +
+ + +
+ + + ZenDesk Access Controller + +
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
    + +
  • »
  • + +
  • Документация контроллера прав доступа
  • + + +
  • + + + Просмотреть исходный код страницы + + +
  • + +
+ + +
+
+
+
+ +
+

Документация контроллера прав доступа¶

+
+

Contents:

+
    +
  • Документация пользователя
      +
    • Управление правами доступа
    • +
    • Главная страница
    • +
    • Регистрация
    • +
    • Авторизация
    • +
    • Профиль
    • +
    • Запрос прав доступа
    • +
    • Управление правами доступа администратором
    • +
    +
  • +
  • Документация разработчика
      +
    • Models
    • +
    • Forms
    • +
    • Extra Functions
    • +
    • Serializers
    • +
    • Views
    • +
    • Обработка тикетов
    • +
    • Обработка статистики
    • +
    • Функционал администратора Zendesk
    • +
    • Тесты
    • +
    +
  • +
  • READ.me
  • +
  • Что необходимо доделать?
      +
    • TODOs
    • +
    +
  • +
+
+
+
+

Indices and tables¶

+
    +
  • Index

  • +
  • Module Index

  • +
  • Search Page

  • +
+
+ + +
+ +
+
+
+ Следующая +
+ +
+ +
+

+ © Copyright 2021, SHP S101, group 2. + +

+
+ + + + Собрано при помощи Sphinx с использованием + + темы, + + предоставленной Read the Docs. + +
+
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/main/views.py b/main/views.py index c3c5e9c..491f4d3 100644 --- a/main/views.py +++ b/main/views.py @@ -459,3 +459,10 @@ def registration_failed(request: WSGIRequest) -> HttpResponse: Функция отображения страницы "Регистрация закрыта". """ return render(request, 'pages/registration_failed.html') + + +def docs_page(request: WSGIRequest) -> HttpResponse: + """ + Функция переадресации на страницу документации. + """ + return render(request, 'pages/documentation.html') From da4ff455d583640d2d171f4a7e4e11eb275362f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=20=D0=9E=D0=BB=D1=8C=D0=B3=D0=B0?= Date: Sat, 29 May 2021 16:30:43 +0300 Subject: [PATCH 3/5] Add link to Ura's server doc --- main/views.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/main/views.py b/main/views.py index 491f4d3..b3f3cde 100644 --- a/main/views.py +++ b/main/views.py @@ -26,7 +26,7 @@ from django_registration.views import RegistrationView from rest_framework import viewsets from rest_framework.response import Response -from access_controller.settings import DEFAULT_FROM_EMAIL, ZENDESK_ROLES, ZENDESK_MAX_AGENTS, ZENDESK_GROUPS +from access_controller.settings import DEFAULT_FROM_EMAIL, ZENDESK_ROLES, ZENDESK_MAX_AGENTS, ZENDESK_GROUPS, DOCS_URL from main.extra_func import check_user_exist, update_profile, get_user_organization, \ make_engineer, make_light_agent, get_users_list, update_users_in_model, count_users, \ set_session_params_for_work_page, get_tickets_list_for_group @@ -461,8 +461,3 @@ def registration_failed(request: WSGIRequest) -> HttpResponse: return render(request, 'pages/registration_failed.html') -def docs_page(request: WSGIRequest) -> HttpResponse: - """ - Функция переадресации на страницу документации. - """ - return render(request, 'pages/documentation.html') From e8e45624d99282985722dc0ccbd5732a68d34275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=20=D0=9E=D0=BB=D1=8C=D0=B3=D0=B0?= Date: Sat, 29 May 2021 16:43:11 +0300 Subject: [PATCH 4/5] Fix problems --- access_controller/urls.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/access_controller/urls.py b/access_controller/urls.py index 74e5cd2..be29d6c 100644 --- a/access_controller/urls.py +++ b/access_controller/urls.py @@ -17,7 +17,7 @@ from django.contrib import admin from django.urls import path, include from main.urls import router -from main.views import main_page, profile_page, CustomRegistrationView, CustomLoginView, registration_error, docs_page +from main.views import main_page, profile_page, CustomRegistrationView, CustomLoginView, registration_error from main.views import registration_failed from main.views import work_page, work_hand_over, work_become_engineer, work_get_tickets, \ AdminPageView, statistic_page @@ -39,7 +39,7 @@ urlpatterns = [ path('registration_failed/', registration_failed, name='registration_failed'), path('control/', AdminPageView.as_view(), name='control'), path('statistic/', statistic_page, name='statistic'), - path('documentation/', docs_page, name='documentation') + ] # Django REST From 01ea7fec99465b71f674933209d5a831c893b9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=20=D0=9E=D0=BB=D1=8C=D0=B3=D0=B0?= Date: Sat, 29 May 2021 16:51:16 +0300 Subject: [PATCH 5/5] Fix one more problem --- main/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/views.py b/main/views.py index b3f3cde..016cfb0 100644 --- a/main/views.py +++ b/main/views.py @@ -26,7 +26,7 @@ from django_registration.views import RegistrationView from rest_framework import viewsets from rest_framework.response import Response -from access_controller.settings import DEFAULT_FROM_EMAIL, ZENDESK_ROLES, ZENDESK_MAX_AGENTS, ZENDESK_GROUPS, DOCS_URL +from access_controller.settings import DEFAULT_FROM_EMAIL, ZENDESK_ROLES, ZENDESK_MAX_AGENTS, ZENDESK_GROUPS from main.extra_func import check_user_exist, update_profile, get_user_organization, \ make_engineer, make_light_agent, get_users_list, update_users_in_model, count_users, \ set_session_params_for_work_page, get_tickets_list_for_group