SimpleDomControl 0.58.6__tar.gz → 0.158.1__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.
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/PKG-INFO +4 -2
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/pyproject.toml +2 -1
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/consumers.py +31 -17
- simpledomcontrol-0.158.1/sdc_core/jwt_utils.py +126 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/init_add/add_controller_manager.py +2 -2
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/init_add/add_model_manager.py +4 -2
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/init_add/sdc_core_manager.py +10 -2
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_init.py +0 -2
- simpledomcontrol-0.158.1/sdc_core/management/commands/sdc_make_model_js.py +118 -0
- simpledomcontrol-0.158.1/sdc_core/management/commands/sdc_open_api.py +445 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/utils/__init__.py +33 -0
- simpledomcontrol-0.158.1/sdc_core/rest_api.py +253 -0
- simpledomcontrol-0.158.1/sdc_core/sdc_extentions/models.py +237 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/sdc_extentions/views.py +25 -5
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/gulpfile.jsx +16 -5
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/src/index.organizer.js +2 -0
- simpledomcontrol-0.158.1/sdc_core/template_files/Assets/tests/config/test-setup.js +51 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/webpack.config/webpack.bundle.config.jsx +14 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/controller/template_controller.js.txt +7 -7
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/models/list.html +25 -15
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/package.json +1 -1
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/settings_extension.py.txt +20 -1
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/templates/elements/inline_form.html +0 -2
- simpledomcontrol-0.158.1/sdc_tools/Assets/bin/sdc_tools/sdc_tools.organizer.js +1 -0
- {simpledomcontrol-0.58.6/sdc_tools/Assets/bin → simpledomcontrol-0.158.1/sdc_tools/Assets/src}/sdc_tools/controller/sdc_detail_view/sdc_detail_view.js +25 -20
- simpledomcontrol-0.158.1/sdc_tools/Assets/src/sdc_tools/controller/sdc_list_view/sdc_list_view.js +107 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_model_form/sdc_model_form.js +32 -30
- {simpledomcontrol-0.58.6/sdc_tools/Assets/bin → simpledomcontrol-0.158.1/sdc_tools/Assets/src}/sdc_tools/controller/sdc_navigator/sdc_navigator.js +4 -2
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/tests/sdc_tools.test.js +2 -1
- simpledomcontrol-0.158.1/sdc_user/Assets/bin/sdc_user/sdc_user.organizer.js +1 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/register/register.js +1 -0
- {simpledomcontrol-0.58.6/sdc_user/Assets/bin → simpledomcontrol-0.158.1/sdc_user/Assets/src}/sdc_user/controller/sdc_user/sdc_user.js +2 -2
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/tests/sdc_user.test.js +2 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/forms.py +3 -1
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/mails.py +34 -3
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/models.py +18 -3
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/sdc_views.py +55 -31
- simpledomcontrol-0.58.6/sdc_core/sdc_extentions/models.py +0 -153
- simpledomcontrol-0.58.6/sdc_core/template_files/Assets/tests/config/test-setup.js +0 -23
- simpledomcontrol-0.58.6/sdc_tools/Assets/bin/sdc_tools/controller/sdc_dummy/sdc_dummy.js +0 -52
- simpledomcontrol-0.58.6/sdc_tools/Assets/bin/sdc_tools/controller/sdc_list_view/sdc_list_view.js +0 -104
- simpledomcontrol-0.58.6/sdc_tools/Assets/bin/sdc_tools/controller/sdc_model_form/sdc_model_form.js +0 -195
- simpledomcontrol-0.58.6/sdc_tools/Assets/bin/sdc_tools/controller/sdc_search_select/sdc_search_select.js +0 -248
- simpledomcontrol-0.58.6/sdc_tools/Assets/bin/sdc_tools/controller/sdc_search_view/sdc_search_view.js +0 -139
- simpledomcontrol-0.58.6/sdc_tools/Assets/bin/sdc_tools/sdc_tools.organizer.js +0 -1
- simpledomcontrol-0.58.6/sdc_tools/Assets/src/sdc_tools/controller/sdc_alert_messenger/sdc_alert_messenger.js +0 -98
- simpledomcontrol-0.58.6/sdc_tools/Assets/src/sdc_tools/controller/sdc_auto_submit/sdc_auto_submit.js +0 -82
- simpledomcontrol-0.58.6/sdc_tools/Assets/src/sdc_tools/controller/sdc_detail_view/sdc_detail_view.js +0 -93
- simpledomcontrol-0.58.6/sdc_tools/Assets/src/sdc_tools/controller/sdc_error/sdc_error.js +0 -46
- simpledomcontrol-0.58.6/sdc_tools/Assets/src/sdc_tools/controller/sdc_list_view/sdc_list_view.js +0 -103
- simpledomcontrol-0.58.6/sdc_tools/Assets/src/sdc_tools/controller/sdc_navigation_client/sdc_navigation_client.js +0 -70
- simpledomcontrol-0.58.6/sdc_tools/Assets/src/sdc_tools/controller/sdc_navigator/sdc_navigator.js +0 -607
- simpledomcontrol-0.58.6/sdc_tools/Assets/src/sdc_tools/controller/sdc_update_on_change/sdc_update_on_change.js +0 -107
- simpledomcontrol-0.58.6/sdc_user/Assets/bin/sdc_user/controller/register/register.js +0 -59
- simpledomcontrol-0.58.6/sdc_user/Assets/bin/sdc_user/sdc_user.organizer.js +0 -1
- simpledomcontrol-0.58.6/sdc_user/Assets/src/sdc_user/controller/sdc_change_password/sdc_change_password.js +0 -59
- simpledomcontrol-0.58.6/sdc_user/Assets/src/sdc_user/controller/sdc_confirm_email/sdc_confirm_email.js +0 -59
- simpledomcontrol-0.58.6/sdc_user/Assets/src/sdc_user/controller/sdc_login/sdc_login.js +0 -53
- simpledomcontrol-0.58.6/sdc_user/Assets/src/sdc_user/controller/sdc_logout/sdc_logout.js +0 -49
- simpledomcontrol-0.58.6/sdc_user/Assets/src/sdc_user/controller/sdc_password_forgotten/sdc_password_forgotten.js +0 -65
- simpledomcontrol-0.58.6/sdc_user/Assets/src/sdc_user/controller/sdc_reset_password/sdc_reset_password.js +0 -59
- simpledomcontrol-0.58.6/sdc_user/Assets/src/sdc_user/controller/sdc_user/sdc_user.js +0 -72
- simpledomcontrol-0.58.6/sdc_user/Assets/src/sdc_user/controller/sdc_user_nav_btn/sdc_user_nav_btn.js +0 -55
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/README.md +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/apps.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/_private.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/init_add/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/init_add/options.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/init_add/settings_manager.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/init_add/utils.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_cc.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_db_tools.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_get_controller_infos.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_get_controller_url.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_get_model_infos.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_is_installed.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_new_model.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_overwrite_lib_file.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_shell_execute_script.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_update_links.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_update_url.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/sdc_extentions/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/sdc_extentions/forms.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/sdc_extentions/import_manager.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/sdc_extentions/response.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/sdc_extentions/search.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/signals.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/.devcontainer/Dockerfile +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/.devcontainer/devcontainer.json +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/.devcontainer/on_create.sh +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/.devcontainer/on_startup.sh +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/babel.config.json +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/src/index.style.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/static/img/favicon.png +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/tests/config/post-test-teardown.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/tests/config/pre-test-setup.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/webpack.config/webpack.default.config.jsx +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/webpack.config/webpack.development.config.jsx +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/Assets/webpack.config/webpack.production.config.jsx +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/asgi.py.txt +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/controller/template_css.scss +0 -0
- /simpledomcontrol-0.58.6/sdc_core/template_files/controller/template_test.js.text → /simpledomcontrol-0.158.1/sdc_core/template_files/controller/template_test.js.txt +0 -0
- /simpledomcontrol-0.58.6/sdc_core/template_files/controller/templade_view.html → /simpledomcontrol-0.158.1/sdc_core/template_files/controller/template_view.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/js_test.js.txt +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/models/detail.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/routing.py.txt +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/sdc_urls.py.txt +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/sdc_views.py.txt +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/templates/base.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/templates/elements/form.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/templates/index.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/template_files/urls.py.txt +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/templatetags/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/templatetags/addclass.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/templatetags/indexfilter.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/templatetags/sdc_filter.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/bin/sdc_tools/sdc_tools.style.css +0 -0
- {simpledomcontrol-0.58.6/sdc_tools/Assets/bin → simpledomcontrol-0.158.1/sdc_tools/Assets/src}/sdc_tools/controller/sdc_alert_messenger/sdc_alert_messenger.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_alert_messenger/sdc_alert_messenger.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_tools/Assets/bin → simpledomcontrol-0.158.1/sdc_tools/Assets/src}/sdc_tools/controller/sdc_auto_submit/sdc_auto_submit.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_detail_view/sdc_detail_view.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_dummy/sdc_dummy.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_dummy/sdc_dummy.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_tools/Assets/bin → simpledomcontrol-0.158.1/sdc_tools/Assets/src}/sdc_tools/controller/sdc_error/sdc_error.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_error/sdc_error.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_list_view/sdc_list_view.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_model_form/sdc_model_form.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_tools/Assets/bin → simpledomcontrol-0.158.1/sdc_tools/Assets/src}/sdc_tools/controller/sdc_navigation_client/sdc_navigation_client.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_navigator/sdc_navigator.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_search_select/sdc_search_select.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_search_select/sdc_search_select.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_search_view/sdc_search_view.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/controller/sdc_search_view/sdc_search_view.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_tools/Assets/bin → simpledomcontrol-0.158.1/sdc_tools/Assets/src}/sdc_tools/controller/sdc_update_on_change/sdc_update_on_change.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/sdc_tools.organizer.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/Assets/src/sdc_tools/sdc_tools.style.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/admin.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/apps.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/migrations/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/models.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/sdc_urls.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/sdc_views.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/email/base.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/dummy_sdc.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/sdc_alert_messenger.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/sdc_detail_view.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/sdc_dummy.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/sdc_error.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/sdc_list_view.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/sdc_model_form.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/sdc_navigator.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/sdc_search_select.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/sdc_tools/sdc/sdc_search_view.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/templates/widgets/searchable_select.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/tests.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/views.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_tools/widgets.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/bin/sdc_user/sdc_user.style.css +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/register/register.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_user/Assets/bin → simpledomcontrol-0.158.1/sdc_user/Assets/src}/sdc_user/controller/sdc_change_password/sdc_change_password.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/sdc_change_password/sdc_change_password.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_user/Assets/bin → simpledomcontrol-0.158.1/sdc_user/Assets/src}/sdc_user/controller/sdc_confirm_email/sdc_confirm_email.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/sdc_confirm_email/sdc_confirm_email.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_user/Assets/bin → simpledomcontrol-0.158.1/sdc_user/Assets/src}/sdc_user/controller/sdc_login/sdc_login.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/sdc_login/sdc_login.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_user/Assets/bin → simpledomcontrol-0.158.1/sdc_user/Assets/src}/sdc_user/controller/sdc_logout/sdc_logout.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/sdc_logout/sdc_logout.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_user/Assets/bin → simpledomcontrol-0.158.1/sdc_user/Assets/src}/sdc_user/controller/sdc_password_forgotten/sdc_password_forgotten.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/sdc_password_forgotten/sdc_password_forgotten.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_user/Assets/bin → simpledomcontrol-0.158.1/sdc_user/Assets/src}/sdc_user/controller/sdc_reset_password/sdc_reset_password.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/sdc_reset_password/sdc_reset_password.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/sdc_user/sdc_user.scss +0 -0
- {simpledomcontrol-0.58.6/sdc_user/Assets/bin → simpledomcontrol-0.158.1/sdc_user/Assets/src}/sdc_user/controller/sdc_user_nav_btn/sdc_user_nav_btn.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/controller/sdc_user_nav_btn/sdc_user_nav_btn.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/sdc_user.organizer.js +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/Assets/src/sdc_user/sdc_user.style.scss +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/admin.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/apps.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/migrations/0001_initial.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/migrations/__init__.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/sdc_urls.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/email/confirm.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/email/reset_password.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/models/SdcUser/SdcUser_details.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/models/SdcUser/SdcUser_list.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/sdc/register.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/sdc/sdc_change_password.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/sdc/sdc_confirm_email.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/sdc/sdc_login.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/sdc/sdc_logout.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/sdc/sdc_password_forgotten.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/sdc/sdc_reset_password.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/sdc_user/sdc/sdc_user_nav_btn.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/templates/widgets/read_only_password_hash.html +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/tests.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/views.py +0 -0
- {simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_user/widgets.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: SimpleDomControl
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.158.1
|
|
4
4
|
Summary: Simple DOM control -> a django MVC framework
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Keywords: django,MVC
|
|
@@ -12,6 +12,7 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
16
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
16
17
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
18
|
Requires-Dist: attrs (>=25.4.0,<26.0.0)
|
|
@@ -24,6 +25,7 @@ Requires-Dist: inquirerpy (>=0.3.4,<0.4.0)
|
|
|
24
25
|
Requires-Dist: poetry-core (>=2.3.1,<3.0.0)
|
|
25
26
|
Requires-Dist: psycopg2-binary (>=2.9.11,<3.0.0)
|
|
26
27
|
Requires-Dist: pyjwt (>=2.11.0,<3.0.0)
|
|
28
|
+
Requires-Dist: pyyaml (>=6.0.3,<7.0.0)
|
|
27
29
|
Requires-Dist: regex (>=2026.1.15,<2027.0.0)
|
|
28
30
|
Project-URL: Homepage, https://github.com/StarmanMartin/sdc
|
|
29
31
|
Description-Content-Type: text/markdown
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "SimpleDomControl"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.158.1"
|
|
4
4
|
authors = [ "Martin Starman <private@martin-starman.com>", ]
|
|
5
5
|
description = "Simple DOM control -> a django MVC framework"
|
|
6
6
|
readme = "README.md"
|
|
@@ -30,6 +30,7 @@ click = ">=8.1.0"
|
|
|
30
30
|
pyjwt = "^2.11.0"
|
|
31
31
|
inquirerpy = "^0.3.4"
|
|
32
32
|
poetry-core = "^2.3.1"
|
|
33
|
+
pyyaml = "^6.0.3"
|
|
33
34
|
|
|
34
35
|
[tool.pytest.ini_options]
|
|
35
36
|
pythonpath = [
|
|
@@ -3,11 +3,13 @@ import os
|
|
|
3
3
|
import types
|
|
4
4
|
import traceback
|
|
5
5
|
|
|
6
|
+
from django.apps import apps
|
|
6
7
|
from django.conf import settings
|
|
7
8
|
from django.core.exceptions import PermissionDenied
|
|
8
9
|
from django.core.files.uploadhandler import TemporaryFileUploadHandler
|
|
9
10
|
|
|
10
11
|
from django.utils.datastructures import MultiValueDict
|
|
12
|
+
from django.utils.html import escape
|
|
11
13
|
from django.utils.translation import gettext as _f
|
|
12
14
|
from django.contrib.auth import get_user_model
|
|
13
15
|
from channels.generic.websocket import WebsocketConsumer, AsyncWebsocketConsumer
|
|
@@ -16,10 +18,11 @@ from asgiref.sync import async_to_sync
|
|
|
16
18
|
import importlib
|
|
17
19
|
import json
|
|
18
20
|
|
|
19
|
-
from sdc_core.sdc_extentions.models import SdcModel, SDCSerializer, all_models
|
|
21
|
+
from sdc_core.sdc_extentions.models import SdcModel, SDCSerializer, all_models, sanitize_filter_query
|
|
20
22
|
from sdc_core.sdc_extentions.response import sdc_link_factory, sdc_link_obj_factory
|
|
21
23
|
from sdc_core.sdc_extentions.import_manager import import_function
|
|
22
|
-
from sdc_core.sdc_extentions.
|
|
24
|
+
from sdc_core.sdc_extentions.search import handle_search_form
|
|
25
|
+
from sdc_core.sdc_extentions.views import SdcAccessMixin, is_valid_server_call
|
|
23
26
|
|
|
24
27
|
import logging
|
|
25
28
|
|
|
@@ -126,13 +129,19 @@ class SDCConsumer(AsyncWebsocketConsumer):
|
|
|
126
129
|
try:
|
|
127
130
|
json_data = json.loads(text_data)
|
|
128
131
|
if json_data['event'] == 'sdc_call':
|
|
132
|
+
app_name = json_data['app']
|
|
133
|
+
func_name = json_data['function']
|
|
134
|
+
# Reject client-controlled imports of non-installed apps and any
|
|
135
|
+
# private/framework method name before resolving the controller.
|
|
136
|
+
if not apps.is_installed(app_name) or not is_valid_server_call(func_name):
|
|
137
|
+
raise PermissionDenied()
|
|
129
138
|
controller_name = self.to_camel_case(json_data['controller'])
|
|
130
|
-
controller = import_function("%s.sdc_views.%s" % (
|
|
139
|
+
controller = import_function("%s.sdc_views.%s" % (app_name, controller_name))
|
|
131
140
|
c_instance = controller()
|
|
132
141
|
if isinstance(c_instance, SdcAccessMixin):
|
|
133
142
|
if not await c_instance.async_check_requirements(self.scope['user']):
|
|
134
143
|
raise PermissionDenied()
|
|
135
|
-
method = getattr(controller(),
|
|
144
|
+
method = getattr(controller(), func_name)
|
|
136
145
|
|
|
137
146
|
logger.info(f"SDC call Socket received: {json_data['app']}.{controller_name}.{json_data['function']}")
|
|
138
147
|
if asyncio.iscoroutinefunction(method):
|
|
@@ -281,8 +290,8 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
281
290
|
traceback.print_tb(e.__traceback__)
|
|
282
291
|
else:
|
|
283
292
|
logger.error(e_text)
|
|
284
|
-
|
|
285
|
-
e_text = _f('Something went wrong!
|
|
293
|
+
# Do not leak internal exception details to the client in production.
|
|
294
|
+
e_text = _f('Something went wrong!')
|
|
286
295
|
|
|
287
296
|
self.state_error({
|
|
288
297
|
'type': msg_type,
|
|
@@ -313,7 +322,7 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
313
322
|
data_load_result = self.model.data_load(self.scope['user'], queryset, self.queryset)
|
|
314
323
|
if data_load_result is not None:
|
|
315
324
|
return data_load_result
|
|
316
|
-
res = queryset.filter(**self.queryset)
|
|
325
|
+
res = queryset.filter(**sanitize_filter_query(self.model, self.queryset))
|
|
317
326
|
self.ids = list(res.values_list('id', flat=True))
|
|
318
327
|
|
|
319
328
|
return res
|
|
@@ -343,7 +352,7 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
343
352
|
instance.scope = self.scope
|
|
344
353
|
form_name = json_data['args']['form_name']
|
|
345
354
|
if not hasattr(self.model.SdcMeta, form_name):
|
|
346
|
-
raise
|
|
355
|
+
raise NotImplementedError()
|
|
347
356
|
|
|
348
357
|
return self._load_form(json_data, getattr(self.model.SdcMeta, form_name), instance)
|
|
349
358
|
|
|
@@ -351,7 +360,7 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
351
360
|
if callable(form_attr):
|
|
352
361
|
form_attr = form_attr({})
|
|
353
362
|
if form_attr is None:
|
|
354
|
-
raise
|
|
363
|
+
raise NotImplementedError()
|
|
355
364
|
elif isinstance(form_attr, str):
|
|
356
365
|
edit_form_path = form_attr.split('.')
|
|
357
366
|
form = getattr(importlib.import_module('.'.join(edit_form_path[0:-1])), edit_form_path[-1])
|
|
@@ -373,7 +382,7 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
373
382
|
return self._submit_element(json_data, self.model.SdcMeta.create_form, instance)
|
|
374
383
|
|
|
375
384
|
def _save_element(self, json_data):
|
|
376
|
-
instance = self._load_model().get(pk=json_data['args']['
|
|
385
|
+
instance = self._load_model().get(pk=json_data['args']['pk'])
|
|
377
386
|
instance.scope = self.scope
|
|
378
387
|
key = str(json_data['args'].get('form_name', 'edit_form'))
|
|
379
388
|
if not hasattr(self.model.SdcMeta, key):
|
|
@@ -392,7 +401,11 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
392
401
|
field_name=file_data['field_name'],
|
|
393
402
|
content_type=file_data['content_type'],
|
|
394
403
|
content_length=file_data['content_length'], )
|
|
395
|
-
|
|
404
|
+
if isinstance(file_data['chunk'], list):
|
|
405
|
+
data = bytes(file_data['chunk'])
|
|
406
|
+
else:
|
|
407
|
+
data = file_data['chunk'].encode()
|
|
408
|
+
handler.receive_data_chunk(data, int(file_data['idx']))
|
|
396
409
|
number_of_chunks = number_of_chunks - 1
|
|
397
410
|
self._upload_handler[json_data['event_id']] = (handler, number_of_chunks)
|
|
398
411
|
if number_of_chunks == 0:
|
|
@@ -407,7 +420,7 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
407
420
|
data = json_data['args']['data']
|
|
408
421
|
files = json_data['args'].get('files')
|
|
409
422
|
if form_attr is None:
|
|
410
|
-
raise
|
|
423
|
+
raise NotImplementedError()
|
|
411
424
|
elif isinstance(form_attr, str):
|
|
412
425
|
edit_form_path = form_attr.split('.')
|
|
413
426
|
form = getattr(importlib.import_module('.'.join(edit_form_path[0:-1])), edit_form_path[-1])
|
|
@@ -430,7 +443,7 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
430
443
|
else:
|
|
431
444
|
msg = {'header': 'Upss!',
|
|
432
445
|
'msg': "<ul>%s</ul>" % "\n".join(
|
|
433
|
-
["<li>%s: %s</li>" % (k, v[0]) for k, v in form_instance.errors.items()])
|
|
446
|
+
["<li>%s: %s</li>" % (escape(k), escape(v[0])) for k, v in form_instance.errors.items()])
|
|
434
447
|
}
|
|
435
448
|
|
|
436
449
|
self.send(text_data=json.dumps(msg | {
|
|
@@ -445,12 +458,13 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
445
458
|
|
|
446
459
|
def _load_list_view(self, json_data):
|
|
447
460
|
if self.model.SdcMeta.html_list_template is None:
|
|
448
|
-
raise
|
|
461
|
+
raise NotImplementedError()
|
|
462
|
+
filter = self.queryset.pop('__search_values', {})
|
|
449
463
|
loaded_data = self._load_model()
|
|
450
464
|
self.send(text_data=json.dumps({
|
|
451
465
|
'type': json_data['event_type'],
|
|
452
466
|
'event_id': json_data['event_id'],
|
|
453
|
-
'html': self._render(self.model.SdcMeta.html_list_template, {'instances': loaded_data}, json_data),
|
|
467
|
+
'html': self._render(self.model.SdcMeta.html_list_template, {'instances': loaded_data, 'filter': filter}, json_data),
|
|
454
468
|
'args': self._prepare_loaded_data(loaded_data),
|
|
455
469
|
'is_error': False
|
|
456
470
|
}))
|
|
@@ -459,7 +473,7 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
459
473
|
loaded_data = self._load_model()
|
|
460
474
|
view_name = json_data['args']['view_name']
|
|
461
475
|
if not hasattr(self.model.SdcMeta, view_name):
|
|
462
|
-
raise
|
|
476
|
+
raise NotImplementedError()
|
|
463
477
|
self.send(text_data=json.dumps({
|
|
464
478
|
'type': json_data['event_type'],
|
|
465
479
|
'event_id': json_data['event_id'],
|
|
@@ -470,7 +484,7 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
470
484
|
|
|
471
485
|
def _load_detail_view(self, json_data):
|
|
472
486
|
if self.model.SdcMeta.html_detail_template is None:
|
|
473
|
-
raise
|
|
487
|
+
raise NotImplementedError()
|
|
474
488
|
instance = self._load_model().get(pk=json_data['args']['pk'])
|
|
475
489
|
instance.scope = self.scope
|
|
476
490
|
self.send(text_data=json.dumps({
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import jwt
|
|
2
|
+
import datetime
|
|
3
|
+
|
|
4
|
+
from django.conf import settings
|
|
5
|
+
|
|
6
|
+
from functools import wraps
|
|
7
|
+
|
|
8
|
+
from django.http import JsonResponse
|
|
9
|
+
from django.contrib.auth import get_user_model
|
|
10
|
+
|
|
11
|
+
User = get_user_model()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def generate_jwt(user):
|
|
15
|
+
payload = {
|
|
16
|
+
"user_id": user.id,
|
|
17
|
+
"username": user.username,
|
|
18
|
+
"iat": user.last_login,
|
|
19
|
+
"exp": datetime.datetime.now(datetime.UTC) + datetime.timedelta(
|
|
20
|
+
seconds=settings.JWT['exp_delta_seconds']
|
|
21
|
+
),
|
|
22
|
+
"type": "auth"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
token = jwt.encode(
|
|
26
|
+
payload,
|
|
27
|
+
settings.JWT['secret'],
|
|
28
|
+
algorithm=settings.JWT['algorithm'],
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
payload = {
|
|
32
|
+
"user_id": user.id,
|
|
33
|
+
"username": user.username,
|
|
34
|
+
"iat": user.last_login,
|
|
35
|
+
"exp": datetime.datetime.now(datetime.UTC) + datetime.timedelta(
|
|
36
|
+
seconds=settings.JWT['exp_delta_seconds'] * 20
|
|
37
|
+
),
|
|
38
|
+
"iat": datetime.datetime.now(datetime.UTC),
|
|
39
|
+
"type": "refresh"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
recover_token = jwt.encode(
|
|
43
|
+
payload,
|
|
44
|
+
settings.JWT['secret'],
|
|
45
|
+
algorithm=settings.JWT['algorithm'],
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
return token, recover_token
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def verify_jwt(token, type):
|
|
52
|
+
|
|
53
|
+
payload = jwt.decode(
|
|
54
|
+
token,
|
|
55
|
+
settings.JWT['secret'],
|
|
56
|
+
algorithms=[settings.JWT['algorithm']],
|
|
57
|
+
)
|
|
58
|
+
if payload is None or payload.get('type') != type:
|
|
59
|
+
raise jwt.InvalidTokenError
|
|
60
|
+
|
|
61
|
+
user = User.objects.get(id=payload["user_id"])
|
|
62
|
+
|
|
63
|
+
if type == 'refresh' and abs(payload['iat'] - user.last_login.timestamp()) > 10:
|
|
64
|
+
raise jwt.InvalidTokenError
|
|
65
|
+
|
|
66
|
+
return payload, user
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def verify_refresh_jwt(token):
|
|
70
|
+
return verify_jwt(token, 'refresh')
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def verify_auth_jwt(token):
|
|
74
|
+
return verify_jwt(token, 'auth')
|
|
75
|
+
|
|
76
|
+
def get_auth_token_from_request(request):
|
|
77
|
+
auth_header = request.headers.get("Authorization")
|
|
78
|
+
|
|
79
|
+
if not auth_header:
|
|
80
|
+
return None, JsonResponse(
|
|
81
|
+
{"error": "Missing Authorization header"},
|
|
82
|
+
status=401,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
try:
|
|
86
|
+
prefix, token = auth_header.split(" ")
|
|
87
|
+
|
|
88
|
+
if prefix.lower() != "bearer":
|
|
89
|
+
raise ValueError()
|
|
90
|
+
|
|
91
|
+
except ValueError:
|
|
92
|
+
return None, JsonResponse(
|
|
93
|
+
{"error": "Invalid Authorization header"},
|
|
94
|
+
status=401,
|
|
95
|
+
)
|
|
96
|
+
return token, None
|
|
97
|
+
|
|
98
|
+
def jwt_required(view_func):
|
|
99
|
+
@wraps(view_func)
|
|
100
|
+
def wrapped(request, *args, **kwargs):
|
|
101
|
+
token, err = get_auth_token_from_request(request)
|
|
102
|
+
if err is not None:
|
|
103
|
+
return err
|
|
104
|
+
try:
|
|
105
|
+
payload, user = verify_auth_jwt(token)
|
|
106
|
+
except jwt.ExpiredSignatureError:
|
|
107
|
+
return JsonResponse(
|
|
108
|
+
{"error": "Expired token"},
|
|
109
|
+
status=401,
|
|
110
|
+
)
|
|
111
|
+
except jwt.InvalidTokenError:
|
|
112
|
+
return JsonResponse(
|
|
113
|
+
{"error": "Invalid token"},
|
|
114
|
+
status=401,
|
|
115
|
+
)
|
|
116
|
+
except User.DoesNotExist:
|
|
117
|
+
return JsonResponse(
|
|
118
|
+
{"error": "User not found"},
|
|
119
|
+
status=401,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
request.user = user
|
|
123
|
+
|
|
124
|
+
return view_func(request, *args, **kwargs)
|
|
125
|
+
|
|
126
|
+
return wrapped
|
|
@@ -164,7 +164,7 @@ class AddControllerManager:
|
|
|
164
164
|
os.path.join(str(main_static), self.controller_name_sc + ".scss"),
|
|
165
165
|
self.reps)
|
|
166
166
|
|
|
167
|
-
copy_and_prepare(os.path.join(options.SCRIPT_ROOT, "template_files", "controller", "
|
|
167
|
+
copy_and_prepare(os.path.join(options.SCRIPT_ROOT, "template_files", "controller", "template_view.html"),
|
|
168
168
|
os.path.join(main_templates, "sdc",
|
|
169
169
|
self.controller_name_sc + ".html"),
|
|
170
170
|
self.reps)
|
|
@@ -190,7 +190,7 @@ class AddControllerManager:
|
|
|
190
190
|
|
|
191
191
|
def add_js_test(self):
|
|
192
192
|
text = prepare_as_string(
|
|
193
|
-
os.path.join(options.SCRIPT_ROOT, "template_files", "controller", "template_test.js.
|
|
193
|
+
os.path.join(options.SCRIPT_ROOT, "template_files", "controller", "template_test.js.txt"), self.reps)
|
|
194
194
|
fp = os.path.join(options.PROJECT_ROOT, self.app_name, 'Assets/tests', f"{self.app_name}.test.js")
|
|
195
195
|
fout = open(fp, "a", encoding='utf-8')
|
|
196
196
|
fout.write(text)
|
|
@@ -60,16 +60,18 @@ class AddModelManager():
|
|
|
60
60
|
'{0}{0}DEFAULT_CHOICES = CHOICES[0][0]',
|
|
61
61
|
'{0}{0}SEARCH_FIELDS = ("id",)',
|
|
62
62
|
'',
|
|
63
|
-
'{0}class
|
|
63
|
+
'{0}class SdcMeta:',
|
|
64
64
|
'{0}{0}"""Meta data information needed to manage all SDC operations."""',
|
|
65
65
|
'{0}{0}edit_form = "{1}.forms.{2}Form"',
|
|
66
|
+
'{0}{0}fields = "__all__"',
|
|
67
|
+
'{0}{0}exclude = None',
|
|
66
68
|
'{0}{0}create_form = "{1}.forms.{2}Form"',
|
|
67
69
|
'{0}{0}html_list_template = "{1}/models/{2}/{2}_list.html"',
|
|
68
70
|
'{0}{0}html_detail_template = "{1}/models/{2}/{2}_details.html"',
|
|
69
71
|
'',
|
|
70
72
|
'{0}@classmethod\n{0}def render(cls, template_name, context=None, request=None, using=None):\n{0}{0}if template_name == cls.SdcMeta.html_list_template:\n{0}{0}{0}sf = cls.SearchForm(data=context.get("filter", {{}}))\n{0}{0}{0}context = context | handle_search_form(context["instances"], sf, range=10)\n{0}{0}return render_to_string(template_name=template_name, context=context, request=request, using=using)',
|
|
71
73
|
'',
|
|
72
|
-
'{0}@classmethod\n{0}def is_authorised(cls, user, action, obj):\n{0}{0}return
|
|
74
|
+
'{0}@classmethod\n{0}def is_authorised(cls, user, action, obj):\n{0}{0}return False',
|
|
73
75
|
'',
|
|
74
76
|
'{0}@classmethod\n{0}def get_queryset(cls, user, action, obj):\n{0}{0}return cls.objects.all()',
|
|
75
77
|
]).format(options.SEP, self.app_name, self.model_name)
|
|
@@ -5,6 +5,7 @@ import shutil
|
|
|
5
5
|
|
|
6
6
|
from sdc_core.management.commands.init_add import options
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
def add_sdc_to_main_urls(main_urls_path):
|
|
9
10
|
fin = open(main_urls_path, "rt", encoding='utf-8')
|
|
10
11
|
text = ""
|
|
@@ -12,13 +13,20 @@ def add_sdc_to_main_urls(main_urls_path):
|
|
|
12
13
|
|
|
13
14
|
for line in fin:
|
|
14
15
|
if 'from django.urls import path' in line:
|
|
15
|
-
line = re.sub(r'path',
|
|
16
|
+
line = re.sub(r'path',
|
|
17
|
+
'path, re_path, include\nfrom django.shortcuts import render\nfrom django.conf import settings\nfrom django.views.i18n import JavaScriptCatalog\nfrom sdc_core.rest_api import AdcApi, get_api_token',
|
|
18
|
+
line)
|
|
16
19
|
|
|
17
20
|
if "urlpatterns = [" in line:
|
|
18
21
|
new_apps = "%sre_path('sdc_view/sdc_tools/', include('sdc_tools.sdc_urls')),\n" % options.SEP
|
|
19
22
|
new_apps += "%sre_path('sdc_view/sdc_user/', include('sdc_user.sdc_urls')),\n" % options.SEP
|
|
23
|
+
|
|
24
|
+
new_apps += f"{options.SEP}path('sdc_api/<str:model>/<int:id>/', AdcApi.as_view()),\n"
|
|
25
|
+
new_apps += f"{options.SEP}path('sdc_api/<str:model>/', AdcApi.as_view()),\n"
|
|
26
|
+
new_apps += f"{options.SEP}path('sdc_api/login/', get_api_token),\n"
|
|
27
|
+
|
|
20
28
|
line = re.sub(r'urlpatterns = \[',
|
|
21
|
-
"urlpatterns = [\n%s%s# scd view below\n" % (new_apps,options.SEP), line)
|
|
29
|
+
"urlpatterns = [\n%s%s# scd view below\n" % (new_apps, options.SEP), line)
|
|
22
30
|
is_done = True
|
|
23
31
|
text += line
|
|
24
32
|
|
{simpledomcontrol-0.58.6 → simpledomcontrol-0.158.1}/sdc_core/management/commands/sdc_init.py
RENAMED
|
@@ -4,14 +4,12 @@ import json
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
6
|
from django.core.management.base import BaseCommand, CommandError
|
|
7
|
-
from django.core import serializers
|
|
8
7
|
from django.utils import timezone
|
|
9
8
|
from sdc_core.management.commands.init_add import options, settings_manager
|
|
10
9
|
from sdc_core.management.commands.init_add.add_controller_manager import AddControllerManager
|
|
11
10
|
from sdc_core.management.commands.init_add.sdc_core_manager import add_sdc_to_main_urls
|
|
12
11
|
from sdc_core.management.commands.init_add.utils import copy, copy_and_prepare, prepare_as_string
|
|
13
12
|
from sdc_core.management.commands.sdc_update_links import make_app_links
|
|
14
|
-
from sdc_core.management.commands.sdc_db_tools import update_to_sdc_user
|
|
15
13
|
|
|
16
14
|
|
|
17
15
|
class Command(BaseCommand):
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import shutil
|
|
3
|
+
from os import makedirs
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from django.core.management import BaseCommand
|
|
7
|
+
|
|
8
|
+
from sdc_core.management.commands.utils import get_model_schema
|
|
9
|
+
from sdc_core.sdc_extentions.models import all_models
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def generate_field_config(field):
|
|
13
|
+
config = {
|
|
14
|
+
"type": field["type"],
|
|
15
|
+
"required": not field["null"] and not field["blank"],
|
|
16
|
+
"max_length": field.get("max_length"),
|
|
17
|
+
"is_relation": field["is_relation"],
|
|
18
|
+
"many_to_many": field["many_to_many"],
|
|
19
|
+
"one_to_many": field["one_to_many"],
|
|
20
|
+
"many_to_one": field["many_to_one"],
|
|
21
|
+
"one_to_one": field["one_to_one"],
|
|
22
|
+
"related_model": field["related_model"],
|
|
23
|
+
"remote_field": field["remote_field"],
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if field["type"] == "FileField":
|
|
27
|
+
config.update({
|
|
28
|
+
# optional — you can hardcode or extract from validators
|
|
29
|
+
"max_size": 5 * 1024 * 1024 * 1024, # 5 MB
|
|
30
|
+
"allowed_types": None, # or list of mime types
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
return config
|
|
34
|
+
|
|
35
|
+
def generate_schema_js(fields):
|
|
36
|
+
schema = {
|
|
37
|
+
f["name"]: generate_field_config(f)
|
|
38
|
+
for f in fields
|
|
39
|
+
}
|
|
40
|
+
return ' static fields = ' + '\n '.join(json.dumps(schema, indent=2).split('\n'))
|
|
41
|
+
|
|
42
|
+
def _generate_js_class(schema):
|
|
43
|
+
class_name = schema["model"]
|
|
44
|
+
|
|
45
|
+
lines = ["import {SdcModel, SdcQuerySet} from 'sdc_client';", "", f"export default class {class_name} extends SdcModel {{", ""]
|
|
46
|
+
constructor_line = [" constructor(data = {}) {", f' super("{class_name}");', f' this._toManyFields = [];']
|
|
47
|
+
setter_line = [" setValues(data = {}) {", f' data.id ??= data.pk ?? null;']
|
|
48
|
+
getter = []
|
|
49
|
+
setter = []
|
|
50
|
+
setter_functions = []
|
|
51
|
+
|
|
52
|
+
field_settings = ["", generate_schema_js(schema["fields"]),""]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
for field in schema["fields"]:
|
|
56
|
+
name = field["name"]
|
|
57
|
+
setter.append(f" set {name}(value){{")
|
|
58
|
+
setter.append(f" this.set{name}(value);")
|
|
59
|
+
setter_functions.append(f" set{name}(value){{")
|
|
60
|
+
setter_functions.append(f" this.validate(value, {class_name}.fields.{name});")
|
|
61
|
+
getter.append(f" get {name}(){{")
|
|
62
|
+
if name == 'id':
|
|
63
|
+
setter_functions.append(" this._toManyFields.forEach(([x, fn]) => x.setFilter({[fn]: value}));")
|
|
64
|
+
setter_line.append(" try {")
|
|
65
|
+
|
|
66
|
+
if field["is_relation"] and field["related_model"]:
|
|
67
|
+
constructor_line.append(f" this._{name} = new SdcQuerySet('{field['related_model']}');")
|
|
68
|
+
if field["many_to_many"] or field["one_to_many"]:
|
|
69
|
+
constructor_line.append(f" this._toManyFields.push([this._{name}, '{field['remote_field']}']);")
|
|
70
|
+
setter_line.append(f" this.{name}.setFilter({{ {field['remote_field']}: data.id }});")
|
|
71
|
+
setter_line.append(f" this.{name} = data.{name} || [];")
|
|
72
|
+
setter_functions.append(f" this._{name}.setIds(this.parseValue(value, {class_name}.fields.{name}));")
|
|
73
|
+
getter.append(f" return this._{name};")
|
|
74
|
+
else:
|
|
75
|
+
setter_line.append(f" if (data.{name}) {{ this.{name} = data.{name}; }}")
|
|
76
|
+
setter_functions.append(f" this._{name}.setIds(this.parseValue(value, {class_name}.fields.{name}));")
|
|
77
|
+
getter.append(f" return this._{name}.length > 0 ? this._{name}[0] : this._{name}.new();")
|
|
78
|
+
else:
|
|
79
|
+
constructor_line.append(f" this._{name} = null;")
|
|
80
|
+
setter_line.append(f" this.{name} = data.{name} ?? null;")
|
|
81
|
+
getter.append(f" return this._{name};")
|
|
82
|
+
setter_functions.append(f" this._{name} = this.parseValue(value, {class_name}.fields.{name});")
|
|
83
|
+
setter_line.append(" } catch {} ")
|
|
84
|
+
setter.append(f" this._updateForm('{name}');")
|
|
85
|
+
setter.append(" }\n")
|
|
86
|
+
setter_functions.append(" }\n")
|
|
87
|
+
getter.append(" }\n")
|
|
88
|
+
constructor_line.append(" this.setValues(data);")
|
|
89
|
+
constructor_line.append(" }")
|
|
90
|
+
setter_line.append(" }")
|
|
91
|
+
|
|
92
|
+
lines += field_settings + constructor_line + [""] + setter_line + [""] + setter + [""] + setter_functions + [""] + getter
|
|
93
|
+
lines.append("}")
|
|
94
|
+
return "\n".join(lines)
|
|
95
|
+
|
|
96
|
+
def _prepare_js_models():
|
|
97
|
+
file_path = Path('Assets/src/models')
|
|
98
|
+
if file_path.exists():
|
|
99
|
+
shutil.rmtree(file_path)
|
|
100
|
+
makedirs(file_path, exist_ok=True)
|
|
101
|
+
src_js = [f"import {{ registerModel }} from 'sdc_client';", ""]
|
|
102
|
+
for name, model in all_models().items():
|
|
103
|
+
src_js.insert(0, f"import {name} from './{name}.js';")
|
|
104
|
+
src_js.append(f'registerModel("{name}", {name});')
|
|
105
|
+
ms = get_model_schema(model)
|
|
106
|
+
with open(file_path / f'{name}.js', 'w+') as f:
|
|
107
|
+
f.write(_generate_js_class(ms))
|
|
108
|
+
with open(file_path / 'src.js', 'w+') as f:
|
|
109
|
+
f.write('\n'.join(src_js))
|
|
110
|
+
|
|
111
|
+
class Command(BaseCommand):
|
|
112
|
+
help = 'This function links all templates into the controller directory'
|
|
113
|
+
|
|
114
|
+
def add_arguments(self, parser):
|
|
115
|
+
pass
|
|
116
|
+
|
|
117
|
+
def handle(self, *args, **ops):
|
|
118
|
+
_prepare_js_models()
|