Documentation fix
Add enchant, remove intersphinx useless links, remove napoleon, fix todos
This commit is contained in:
parent
656081295e
commit
1d7ff524b0
@ -14,21 +14,26 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import importlib
|
import importlib
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath('../../'))
|
sys.path.insert(0, os.path.abspath('../../'))
|
||||||
|
|
||||||
import django
|
import django
|
||||||
|
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'access_controller.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'access_controller.settings')
|
||||||
os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev')
|
os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev')
|
||||||
|
|
||||||
# Fix Django's FileFields
|
# Fix Django's FileFields
|
||||||
from django.db.models.fields.files import FileDescriptor
|
from django.db.models.fields.files import FileDescriptor
|
||||||
FileDescriptor.__get__ = lambda self, *args, **kwargs: self
|
|
||||||
from django.db.models.manager import ManagerDescriptor
|
|
||||||
ManagerDescriptor.__get__ = lambda self, *args, **kwargs: self.manager
|
|
||||||
|
|
||||||
|
FileDescriptor.__get__ = lambda self, *args, **kwargs: self
|
||||||
|
|
||||||
|
from django.db.models.manager import ManagerDescriptor
|
||||||
|
|
||||||
|
ManagerDescriptor.__get__ = lambda self, *args, **kwargs: self.manager
|
||||||
|
|
||||||
# Stop Django from executing DB queries
|
# Stop Django from executing DB queries
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
QuerySet.__repr__ = lambda self: self.__class__.__name__
|
QuerySet.__repr__ = lambda self: self.__class__.__name__
|
||||||
try:
|
try:
|
||||||
import enchant # NoQA
|
import enchant # NoQA
|
||||||
@ -46,7 +51,8 @@ author = 'SHP S101, group 2'
|
|||||||
# The full version, including alpha/beta/rc tags
|
# The full version, including alpha/beta/rc tags
|
||||||
release = 'v0.01'
|
release = 'v0.01'
|
||||||
|
|
||||||
#Django sphinx setup by https://gist.github.com/codingjoe/314bda5a07ff3b41f247
|
|
||||||
|
# Django sphinx setup by https://gist.github.com/codingjoe/314bda5a07ff3b41f247
|
||||||
|
|
||||||
# -- General configuration ---------------------------------------------------
|
# -- General configuration ---------------------------------------------------
|
||||||
|
|
||||||
@ -121,7 +127,6 @@ def setup(app):
|
|||||||
app.connect('autodoc-process-docstring', process_modules)
|
app.connect('autodoc-process-docstring', process_modules)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Add any Sphinx extension module names here, as strings. They can be
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
# ones.
|
# ones.
|
||||||
@ -132,7 +137,6 @@ extensions = [
|
|||||||
'sphinx.ext.viewcode',
|
'sphinx.ext.viewcode',
|
||||||
'sphinx_rtd_theme',
|
'sphinx_rtd_theme',
|
||||||
'sphinx.ext.graphviz',
|
'sphinx.ext.graphviz',
|
||||||
'sphinx.ext.napoleon',
|
|
||||||
'sphinx.ext.inheritance_diagram',
|
'sphinx.ext.inheritance_diagram',
|
||||||
'sphinx_autodoc_typehints'
|
'sphinx_autodoc_typehints'
|
||||||
|
|
||||||
@ -141,7 +145,6 @@ extensions = [
|
|||||||
if enchant is not None:
|
if enchant is not None:
|
||||||
extensions.append('sphinxcontrib.spelling')
|
extensions.append('sphinxcontrib.spelling')
|
||||||
|
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ['_templates']
|
templates_path = ['_templates']
|
||||||
|
|
||||||
@ -157,7 +160,6 @@ language = 'ru'
|
|||||||
# This pattern also affects html_static_path and html_extra_path.
|
# This pattern also affects html_static_path and html_extra_path.
|
||||||
exclude_patterns = []
|
exclude_patterns = []
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTML output -------------------------------------------------
|
# -- Options for HTML output -------------------------------------------------
|
||||||
|
|
||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
@ -170,7 +172,6 @@ html_theme = "sphinx_rtd_theme"
|
|||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
html_static_path = ['_static']
|
html_static_path = ['_static']
|
||||||
|
|
||||||
|
|
||||||
# -- Extension configuration -------------------------------------------------
|
# -- Extension configuration -------------------------------------------------
|
||||||
|
|
||||||
# -- Options for intersphinx extension ---------------------------------------
|
# -- Options for intersphinx extension ---------------------------------------
|
||||||
@ -179,14 +180,9 @@ html_static_path = ['_static']
|
|||||||
intersphinx_mapping = {
|
intersphinx_mapping = {
|
||||||
'https://docs.python.org/3/': None,
|
'https://docs.python.org/3/': None,
|
||||||
'django': (
|
'django': (
|
||||||
'https://docs.djangoproject.com/en/dev/',
|
'https://docs.djangoproject.com/en/dev/',
|
||||||
'https://docs.djangoproject.com/en/dev/_objects/'
|
'https://docs.djangoproject.com/en/dev/_objects/'
|
||||||
),
|
),
|
||||||
'djangoextensions': ('https://django-extensions.readthedocs.org/en/latest/', None),
|
|
||||||
'geoposition': ('https://django-geoposition.readthedocs.org/en/latest/', None),
|
|
||||||
'braces': ('https://django-braces.readthedocs.org/en/latest/', None),
|
|
||||||
'select2': ('https://django-select2.readthedocs.org/en/latest/', None),
|
|
||||||
'celery': ('https://celery.readthedocs.org/en/latest/', None),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
autodoc_default_flags = ['members']
|
autodoc_default_flags = ['members']
|
||||||
|
@ -74,7 +74,10 @@ class ZendeskAdmin:
|
|||||||
|
|
||||||
def get_user(self, email: str) -> str:
|
def get_user(self, email: str) -> str:
|
||||||
"""
|
"""
|
||||||
Функция **get_user** возвращает пользователя (объект) по его email
|
Функция **get_user** возвращает пользователя (объект) по его email
|
||||||
|
|
||||||
|
:param email: email пользователя
|
||||||
|
:return: email пользователя, найденного в БД
|
||||||
"""
|
"""
|
||||||
return self.admin.users.search(email).values[0]
|
return self.admin.users.search(email).values[0]
|
||||||
|
|
||||||
|
@ -5,10 +5,7 @@ from django.dispatch import receiver
|
|||||||
|
|
||||||
|
|
||||||
class UserProfile(models.Model):
|
class UserProfile(models.Model):
|
||||||
"""
|
"""Модель профиля пользователя"""
|
||||||
Модель профиля пользователя
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
user = models.OneToOneField(to=User, on_delete=models.CASCADE, help_text='Пользователь')
|
user = models.OneToOneField(to=User, on_delete=models.CASCADE, help_text='Пользователь')
|
||||||
role = models.CharField(default='None', max_length=100, help_text='Код роли пользователя')
|
role = models.CharField(default='None', max_length=100, help_text='Код роли пользователя')
|
||||||
@ -28,10 +25,7 @@ def save_user_profile(sender, instance, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
class RoleChangeLogs(models.Model):
|
class RoleChangeLogs(models.Model):
|
||||||
"""
|
"""Модель для логирования изменений ролей пользователя"""
|
||||||
Модель для логирования изменений ролей пользователя
|
|
||||||
|
|
||||||
"""
|
|
||||||
user = models.ForeignKey(to=User, on_delete=models.CASCADE, help_text='Пользователь, которому присвоили другую роль')
|
user = models.ForeignKey(to=User, on_delete=models.CASCADE, help_text='Пользователь, которому присвоили другую роль')
|
||||||
name = models.TextField(help_text='Имя пользователя')
|
name = models.TextField(help_text='Имя пользователя')
|
||||||
new_role = models.TextField(help_text='Присвоенная роль')
|
new_role = models.TextField(help_text='Присвоенная роль')
|
||||||
|
@ -188,9 +188,12 @@ class AdminPageView(FormView, LoginRequiredMixin, PermissionRequiredMixin):
|
|||||||
[make_light_agent(user) for user in users]
|
[make_light_agent(user) for user in users]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def count_users(users: User) -> int: #.. todolist:: :this func counts users from all zendesk instead of just from a model:
|
def count_users(users: User) -> int:
|
||||||
"""
|
"""
|
||||||
Функция подсчета количества сотрудников с ролями engineer и light_a
|
Функция подсчета количества сотрудников с ролями engineer и light_a
|
||||||
|
|
||||||
|
.. todo::
|
||||||
|
this func counts users from all zendesk instead of just from a model:
|
||||||
"""
|
"""
|
||||||
engineers, light_agents = 0, 0
|
engineers, light_agents = 0, 0
|
||||||
for user in users:
|
for user in users:
|
||||||
|
@ -4,9 +4,9 @@ Pillow==8.1.0
|
|||||||
zenpy~=2.0.24
|
zenpy~=2.0.24
|
||||||
django_registration==3.1.1
|
django_registration==3.1.1
|
||||||
|
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
Sphinx==3.4.3
|
Sphinx==3.4.3
|
||||||
sphinx-rtd-theme==0.5.1
|
sphinx-rtd-theme==0.5.1
|
||||||
sphinx-autodoc-typehints==1.11.1
|
sphinx-autodoc-typehints==1.11.1
|
||||||
|
pyenchant==3.2.0
|
||||||
|
sphinxcontrib-spelling==7.1.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user