django-pfx 1.2.dev36__tar.gz → 1.2.dev38__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/PKG-INFO +1 -1
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/django_pfx.egg-info/PKG-INFO +1 -1
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/__init__.py +2 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/management/commands/makeapidoc.py +8 -1
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/views/rest_views.py +5 -1
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_api_doc.py +20 -14
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/.gitignore +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/.gitlab-ci.yml +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/.pre-commit-config.yaml +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/LICENSE +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/MANIFEST.in +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/README.md +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/django_pfx.egg-info/SOURCES.txt +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/django_pfx.egg-info/dependency_links.txt +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/django_pfx.egg-info/requires.txt +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/django_pfx.egg-info/top_level.txt +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/img/pfx.png +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/img/pfx.svg +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/apps.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/decorator/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/decorator/rest.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/default_settings.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/exceptions.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/fields.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/http/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/http/json_response.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/locale/fr/LC_MESSAGES/django.mo +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/locale/fr/LC_MESSAGES/django.po +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/management/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/management/commands/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/middleware/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/middleware/authentication.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/middleware/locale.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/models/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/models/cache_mixins.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/models/not_null_fields.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/models/pfx_models.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/models/user_filtered_queryset_mixin.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/serializers/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/serializers/json.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/settings.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/shortcuts.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/storage/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/storage/s3_storage.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/templates/registration/password_reset_email.txt +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/templates/registration/password_reset_subject.txt +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/templates/registration/welcome_email.txt +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/templates/registration/welcome_subject.txt +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/test.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/urls.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/views/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/views/authentication_views.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/views/fields.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/views/filters_views.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/views/locale_views.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pyproject.toml +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/requirements.txt +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/runtest.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/setup.cfg +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/setup.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/models.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/settings/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/settings/ci.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/settings/common.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/settings/dev.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/settings/dev_custom_example.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/settings/dev_default.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/__init__.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/basic_api_errors.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/basic_api_test.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_auth_api.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_cache.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_fields.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_filters.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_locale_api.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_perm_tests.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_perms_api.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_shortcuts.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_timezone_middleware.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_tools.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_user_queryset.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_view_decorators.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/tests/test_view_fields.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/urls.py +0 -0
- {django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/tests/views.py +0 -0
|
@@ -5,6 +5,7 @@ from django.core.management.base import BaseCommand
|
|
|
5
5
|
|
|
6
6
|
from apispec import APISpec
|
|
7
7
|
|
|
8
|
+
from pfx.pfxcore import __PFX_VIEWS__
|
|
8
9
|
from pfx.pfxcore.settings import PFXSettings
|
|
9
10
|
|
|
10
11
|
settings = PFXSettings()
|
|
@@ -15,7 +16,13 @@ DEFAULT_TEMPLATE = dict(
|
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
def get_spec():
|
|
18
|
-
|
|
19
|
+
spec = APISpec(**{**DEFAULT_TEMPLATE, **settings.PFX_OPENAPI_TEMPLATE})
|
|
20
|
+
for view in __PFX_VIEWS__:
|
|
21
|
+
for url in view.get_urls():
|
|
22
|
+
spec.path(
|
|
23
|
+
path=url['path'],
|
|
24
|
+
operations={k: {} for k, v in url['methods'].items()})
|
|
25
|
+
return spec
|
|
19
26
|
|
|
20
27
|
|
|
21
28
|
class Command(BaseCommand):
|
|
@@ -12,6 +12,7 @@ from django.urls import path
|
|
|
12
12
|
from django.utils.translation import gettext_lazy as _
|
|
13
13
|
from django.views import View
|
|
14
14
|
|
|
15
|
+
from pfx.pfxcore import __PFX_VIEWS__
|
|
15
16
|
from pfx.pfxcore.decorator import rest_api
|
|
16
17
|
from pfx.pfxcore.exceptions import (
|
|
17
18
|
APIError,
|
|
@@ -553,7 +554,8 @@ class BaseRestView(SecuredRestViewMixin, View):
|
|
|
553
554
|
@classmethod
|
|
554
555
|
def get_urls(cls, as_pattern=False):
|
|
555
556
|
def fullpath(p2):
|
|
556
|
-
|
|
557
|
+
res = f'{cls.rest_view_path}{p2}'.lstrip('/')
|
|
558
|
+
return res if as_pattern else f'/{res}'
|
|
557
559
|
|
|
558
560
|
paths = {}
|
|
559
561
|
for name in dir(cls):
|
|
@@ -577,6 +579,8 @@ class BaseRestView(SecuredRestViewMixin, View):
|
|
|
577
579
|
|
|
578
580
|
@classmethod
|
|
579
581
|
def as_urlpatterns(cls):
|
|
582
|
+
if cls not in __PFX_VIEWS__:
|
|
583
|
+
__PFX_VIEWS__.append(cls)
|
|
580
584
|
return cls.get_urls(as_pattern=True)
|
|
581
585
|
|
|
582
586
|
|
|
@@ -24,24 +24,30 @@ class ApiDocTest(TestAssertMixin, TestCase):
|
|
|
24
24
|
self.assertEqual(info['version'], "1.0.0")
|
|
25
25
|
self.assertEqual(info['description'], "A test API")
|
|
26
26
|
|
|
27
|
+
def test_paths_generation(self):
|
|
28
|
+
def assertMethods(paths, p, methods):
|
|
29
|
+
self.assertEqual(set(paths[p].keys()), methods)
|
|
30
|
+
|
|
31
|
+
spec = get_spec().to_dict()
|
|
32
|
+
paths = spec['paths']
|
|
33
|
+
assertMethods(paths, '/authors', {'get', 'post'})
|
|
34
|
+
assertMethods(paths, '/authors/<int:id>', {'get', 'put', 'delete'})
|
|
35
|
+
assertMethods(paths, '/authors/slug/<slug:slug>', {'get'})
|
|
36
|
+
assertMethods(paths, '/authors/cache/<int:id>', {'get'})
|
|
37
|
+
|
|
27
38
|
def test_view_get_urls(self):
|
|
28
|
-
def
|
|
29
|
-
|
|
39
|
+
def assertMethods(urls, p, methods):
|
|
40
|
+
self.assertEqual(next(filter(
|
|
41
|
+
lambda u: u['path'] == p, urls))['methods'], methods)
|
|
30
42
|
|
|
31
43
|
urls = AuthorRestView.get_urls()
|
|
32
44
|
|
|
33
45
|
# Methods from RestView
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
self.assertEqual(
|
|
38
|
-
get_methods(urls, 'authors/<int:id>'),
|
|
39
|
-
dict(delete='delete', get='get', put='put'))
|
|
46
|
+
assertMethods(urls, '/authors', dict(get='get_list', post='post'))
|
|
47
|
+
assertMethods(urls, '/authors/<int:id>', dict(
|
|
48
|
+
delete='delete', get='get', put='put'))
|
|
40
49
|
# A method from SlugDetailRestViewMixin
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
dict(get='get_by_slug'))
|
|
50
|
+
assertMethods(urls, '/authors/slug/<slug:slug>', dict(
|
|
51
|
+
get='get_by_slug'))
|
|
44
52
|
# A method from AuthorRestView itself
|
|
45
|
-
|
|
46
|
-
get_methods(urls, 'authors/cache/<int:id>'),
|
|
47
|
-
dict(get='cache_get'))
|
|
53
|
+
assertMethods(urls, '/authors/cache/<int:id>', dict(get='cache_get'))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/models/user_filtered_queryset_mixin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/templates/registration/welcome_email.txt
RENAMED
|
File without changes
|
{django-pfx-1.2.dev36 → django-pfx-1.2.dev38}/pfx/pfxcore/templates/registration/welcome_subject.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|