simpledomcontrol 0.57.7__tar.gz → 0.57.8__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.
Files changed (134) hide show
  1. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/PKG-INFO +1 -1
  2. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/pyproject.toml +1 -1
  3. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/init_add/add_controller_manager.py +44 -47
  4. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/init_add/sdc_core_manager.py +0 -11
  5. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/init_add/settings_manager.py +8 -40
  6. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/init_add/utils.py +14 -26
  7. simpledomcontrol-0.57.8/sdc_core/management/commands/sdc_init.py +93 -0
  8. simpledomcontrol-0.57.8/sdc_core/template_files/Assets/tests/config/test-setup.js +23 -0
  9. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/package.json +3 -2
  10. simpledomcontrol-0.57.8/sdc_core/template_files/settings_extension.py.txt +94 -0
  11. simpledomcontrol-0.57.7/sdc_core/management/commands/sdc_init.py +0 -61
  12. simpledomcontrol-0.57.7/sdc_core/template_files/Assets/tests/config/test-setup.js +0 -10
  13. simpledomcontrol-0.57.7/sdc_core/template_files/apps/sdc_examples/Add_SDCUser.txt +0 -38
  14. simpledomcontrol-0.57.7/sdc_core/template_files/apps/sdc_examples/index.html +0 -50
  15. simpledomcontrol-0.57.7/sdc_core/template_files/apps/sdc_examples/server_call.txt +0 -76
  16. simpledomcontrol-0.57.7/sdc_core/template_files/settings_extension.py.txt +0 -41
  17. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/README.md +0 -0
  18. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/__init__.py +0 -0
  19. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/apps.py +0 -0
  20. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/consumers.py +0 -0
  21. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/__init__.py +0 -0
  22. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/__init__.py +0 -0
  23. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/_private.py +0 -0
  24. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/init_add/__init__.py +0 -0
  25. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/init_add/add_model_manager.py +0 -0
  26. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/init_add/options.py +0 -0
  27. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/sdc_cc.py +0 -0
  28. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/sdc_get_controller_infos.py +0 -0
  29. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/sdc_get_controller_url.py +0 -0
  30. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/sdc_get_model_infos.py +0 -0
  31. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/sdc_is_installed.py +0 -0
  32. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/sdc_new_model.py +0 -0
  33. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/sdc_shell_execute_script.py +0 -0
  34. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/sdc_update_links.py +0 -0
  35. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/management/commands/sdc_update_url.py +0 -0
  36. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/sdc_extentions/__init__.py +0 -0
  37. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/sdc_extentions/forms.py +0 -0
  38. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/sdc_extentions/import_manager.py +0 -0
  39. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/sdc_extentions/models.py +0 -0
  40. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/sdc_extentions/response.py +0 -0
  41. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/sdc_extentions/search.py +0 -0
  42. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/sdc_extentions/views.py +0 -0
  43. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/signals.py +0 -0
  44. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/Assets/.babelrc +0 -0
  45. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/Assets/gulpfile.jsx +0 -0
  46. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/Assets/src/index.organizer.js +0 -0
  47. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/Assets/src/index.style.scss +0 -0
  48. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/Assets/tests/config/post-test-teardown.js +0 -0
  49. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/Assets/tests/config/pre-test-setup.js +0 -0
  50. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/Assets/webpack.config/webpack.default.config.jsx +0 -0
  51. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/Assets/webpack.config/webpack.development.config.jsx +0 -0
  52. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/Assets/webpack.config/webpack.production.config.jsx +0 -0
  53. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/asgi.py.txt +0 -0
  54. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/controller/templade_view.html +0 -0
  55. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/controller/template_controller.js.txt +0 -0
  56. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/controller/template_css.scss +0 -0
  57. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/controller/template_test.js.text +0 -0
  58. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/js_test.js.txt +0 -0
  59. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/models/detail.html +0 -0
  60. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/models/list.html +0 -0
  61. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/routing.py.txt +0 -0
  62. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/sdc_urls.py.txt +0 -0
  63. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/sdc_views.py.txt +0 -0
  64. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/templates/base.html +0 -0
  65. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/templates/index.html +0 -0
  66. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_core/template_files/urls.py.txt +0 -0
  67. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_alert_messenger/sdc_alert_messenger.js +0 -0
  68. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_alert_messenger/sdc_alert_messenger.scss +0 -0
  69. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_auto_submit/sdc_auto_submit.js +0 -0
  70. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_detail_view/sdc_detail_view.js +0 -0
  71. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_detail_view/sdc_detail_view.scss +0 -0
  72. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_dummy/sdc_dummy.js +0 -0
  73. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_dummy/sdc_dummy.scss +0 -0
  74. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_error/sdc_error.js +0 -0
  75. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_error/sdc_error.scss +0 -0
  76. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_list_view/sdc_list_view.js +0 -0
  77. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_list_view/sdc_list_view.scss +0 -0
  78. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_model_form/sdc_model_form.js +0 -0
  79. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_model_form/sdc_model_form.scss +0 -0
  80. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_navigation_client/sdc_navigation_client.js +0 -0
  81. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_navigator/sdc_navigator.js +0 -0
  82. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_navigator/sdc_navigator.scss +0 -0
  83. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_search_view/sdc_search_view.js +0 -0
  84. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_search_view/sdc_search_view.scss +0 -0
  85. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/controller/sdc_update_on_change/sdc_update_on_change.js +0 -0
  86. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/sdc_tools.organizer.js +0 -0
  87. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/src/sdc_tools/sdc_tools.style.scss +0 -0
  88. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/Assets/tests/sdc_tools.test.js +0 -0
  89. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/__init__.py +0 -0
  90. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/admin.py +0 -0
  91. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/apps.py +0 -0
  92. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/migrations/__init__.py +0 -0
  93. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/models.py +0 -0
  94. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/sdc_urls.py +0 -0
  95. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/sdc_views.py +0 -0
  96. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/elements/form.html +0 -0
  97. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/elements/inline_form.html +0 -0
  98. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/email/base.html +0 -0
  99. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/sdc_tools/sdc/dummy_sdc.html +0 -0
  100. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/sdc_tools/sdc/sdc_alert_messenger.html +0 -0
  101. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/sdc_tools/sdc/sdc_detail_view.html +0 -0
  102. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/sdc_tools/sdc/sdc_dummy.html +0 -0
  103. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/sdc_tools/sdc/sdc_error.html +0 -0
  104. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/sdc_tools/sdc/sdc_list_view.html +0 -0
  105. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/sdc_tools/sdc/sdc_model_form.html +0 -0
  106. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/sdc_tools/sdc/sdc_navigator.html +0 -0
  107. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templates/sdc_tools/sdc/sdc_search_view.html +0 -0
  108. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templatetags/__init__.py +0 -0
  109. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templatetags/addclass.py +0 -0
  110. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templatetags/indexfilter.py +0 -0
  111. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/templatetags/sdc_filter.py +0 -0
  112. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/tests.py +0 -0
  113. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_tools/views.py +0 -0
  114. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/Assets/src/sdc_user/controller/sdc_login/sdc_login.js +0 -0
  115. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/Assets/src/sdc_user/controller/sdc_login/sdc_login.scss +0 -0
  116. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/Assets/src/sdc_user/controller/sdc_logout/sdc_logout.js +0 -0
  117. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/Assets/src/sdc_user/controller/sdc_logout/sdc_logout.scss +0 -0
  118. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/Assets/src/sdc_user/controller/sdc_user_nav_btn/sdc_user_nav_btn.js +0 -0
  119. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/Assets/src/sdc_user/controller/sdc_user_nav_btn/sdc_user_nav_btn.scss +0 -0
  120. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/Assets/src/sdc_user/sdc_user.organizer.js +0 -0
  121. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/Assets/src/sdc_user/sdc_user.style.scss +0 -0
  122. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/Assets/tests/sdc_user.test.js +0 -0
  123. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/__init__.py +0 -0
  124. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/admin.py +0 -0
  125. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/apps.py +0 -0
  126. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/migrations/__init__.py +0 -0
  127. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/models.py +0 -0
  128. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/sdc_urls.py +0 -0
  129. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/sdc_views.py +0 -0
  130. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/templates/sdc_user/sdc/sdc_login.html +0 -0
  131. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/templates/sdc_user/sdc/sdc_logout.html +0 -0
  132. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/templates/sdc_user/sdc/sdc_user_nav_btn.html +0 -0
  133. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/tests.py +0 -0
  134. {simpledomcontrol-0.57.7 → simpledomcontrol-0.57.8}/sdc_user/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SimpleDomControl
3
- Version: 0.57.7
3
+ Version: 0.57.8
4
4
  Summary: Simple DOM control -> a django MVC framework
5
5
  Home-page: https://github.com/StarmanMartin/sdc
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "SimpleDomControl"
3
- version = "0.57.7"
3
+ version = "0.57.8"
4
4
  authors = [ "Martin Starman <private@martin-starman.com>", ]
5
5
  description = "Simple DOM control -> a django MVC framework"
6
6
  readme = "README.md"
@@ -46,6 +46,20 @@ class AddControllerManager:
46
46
  return url_to_sdc
47
47
  return ''
48
48
 
49
+ @classmethod
50
+ def add_js_app_to_organizer(cls, app_name):
51
+ org_file_path_root = os.path.join(options.PROJECT_ROOT, "Assets/src",
52
+ "index.organizer.js")
53
+ line = 'import {} from "./%s/%s.organizer.js";\n' % (app_name, app_name)
54
+ cls._add_js_to_src(org_file_path_root, line)
55
+
56
+ @classmethod
57
+ def add_css_app_to_organizer(cls, app_name):
58
+ org_file_path_root = os.path.join(options.PROJECT_ROOT, "Assets/src",
59
+ "index.style.scss")
60
+ line = '@use "%s/%s.style";\n' % (app_name, app_name)
61
+ cls._add_scss_to_src(org_file_path_root, line)
62
+
49
63
  def check_if_url_is_unique(self):
50
64
  return not self.check_controller_name(self.controller_name_sc)
51
65
 
@@ -150,21 +164,13 @@ class AddControllerManager:
150
164
  "%s.style.scss" % self.app_name)
151
165
 
152
166
  if not os.path.exists(org_js_file_path):
153
- org_file_path_root = os.path.join(options.PROJECT_ROOT, "Assets/src",
154
- "index.organizer.js")
155
- line = 'import {} from "./%s/%s.organizer.js";\n' % (self.app_name, self.app_name)
156
-
157
- self._add_js_to_src(org_file_path_root, line)
167
+ self.add_js_app_to_organizer(self.app_name)
158
168
 
159
169
  if add_css:
160
170
  if not os.path.exists(org_style_file_path):
161
- org_file_path_root = os.path.join(options.PROJECT_ROOT, "Assets/src",
162
- "index.style.scss")
163
- line = '@use "./%s/%s.style.scss";\n' % (self.app_name, self.app_name)
171
+ self.add_css_app_to_organizer(self.app_name)
164
172
 
165
- self._add_scss_to_src(org_file_path_root, line)
166
-
167
- line = '@use "./controller/%s/%s.scss";\n' % (self.controller_name_sc, self.controller_name_sc)
173
+ line = '@use "controller/%s/%s";\n' % (self.controller_name_sc, self.controller_name_sc)
168
174
  self._add_scss_to_src(org_style_file_path, line)
169
175
 
170
176
  line = 'import {} from "./controller/%s/%s.js";\n' % (self.controller_name_sc, self.controller_name_sc)
@@ -179,45 +185,36 @@ class AddControllerManager:
179
185
  fout.close()
180
186
 
181
187
  @staticmethod
182
- def _add_js_to_src(org_file_path, new_line):
183
- text = new_line
184
- if not os.path.exists(org_file_path):
185
- fin = open(org_file_path, 'x', encoding='utf-8')
186
- else:
187
- fin = open(org_file_path, 'r', encoding='utf-8')
188
-
189
- for line in fin:
190
- text += line
191
-
192
- fin.close()
193
-
194
- fout = open(org_file_path, "w+", encoding='utf-8')
195
- fout.write(text)
196
- fout.close()
188
+ def _add_js_to_src(org_file_path, new_line: str):
189
+ text = []
190
+ new_line = new_line.strip('\n')
191
+ if os.path.exists(org_file_path):
192
+ with open(org_file_path, 'r', encoding='utf-8') as fin:
193
+ for line in fin:
194
+ text.append(line.strip('\n'))
195
+
196
+ if new_line not in text:
197
+ text.insert(0, new_line)
198
+ with open(org_file_path, "w+", encoding='utf-8') as fout:
199
+ fout.write('\n'.join(text))
197
200
 
198
201
  @staticmethod
199
202
  def _add_scss_to_src(org_file_path, new_line):
200
-
201
- if not os.path.exists(org_file_path):
202
- fin = open(org_file_path, 'x', encoding='utf-8')
203
- text = new_line
204
- else:
205
- fin = open(org_file_path, 'r', encoding='utf-8')
206
- text = ''
207
- added = False
208
- for line in fin:
209
- if not line.startswith('@use') and not added:
210
- text += "%s" % new_line
211
- added = True
212
- text += line
213
- if not added:
214
- text += "%s" % new_line
215
-
216
- fin.close()
217
-
218
- fout = open(org_file_path, "w+", encoding='utf-8')
219
- fout.write(text)
220
- fout.close()
203
+ add_idx = 0
204
+ text = []
205
+ new_line = new_line.strip('\n')
206
+ if os.path.exists(org_file_path):
207
+ with open(org_file_path, 'r', encoding='utf-8') as fin:
208
+ add_idx = -1
209
+ for idx, line in enumerate(fin):
210
+ if not line.startswith('@use') and add_idx == -1:
211
+ add_idx = idx
212
+ text.append(line.strip('\n'))
213
+
214
+ if new_line not in text:
215
+ text.insert(add_idx, new_line)
216
+ with open(org_file_path, "w+", encoding='utf-8') as fout:
217
+ fout.write('\n'.join(text))
221
218
 
222
219
  @staticmethod
223
220
  def _add_to_urls(main_urls_path, url_path, handler):
@@ -5,17 +5,6 @@ import shutil
5
5
 
6
6
  from sdc_core.management.commands.init_add import options
7
7
 
8
- def copy_apps():
9
- for tool in ['sdc_examples']:
10
- src = os.path.join(options.SCRIPT_ROOT, "template_files", 'apps', tool)
11
- dest = os.path.join(options.PROJECT_ROOT, tool)
12
- try:
13
- shutil.copytree(src, dest)
14
- except OSError as exc: # python >2.5
15
- if exc.errno == errno.ENOTDIR:
16
- shutil.copy(src, dest)
17
- else: raise
18
-
19
8
  def add_sdc_to_main_urls(main_urls_path):
20
9
  fin = open(main_urls_path, "rt", encoding='utf-8')
21
10
  text = ""
@@ -52,46 +52,14 @@ class SettingsManager:
52
52
  exit(1)
53
53
 
54
54
  def update_settings(self, settings_extension):
55
-
56
- apps = self.get_setting_vals().INSTALLED_APPS
57
- apps = [a for a in apps if a != 'sdc_core']
58
- apps.insert(0, 'daphne')
59
- apps.append('channels')
60
- apps.append('sdc_tools')
61
- apps.append('sdc_user')
62
- apps.append('sdc_core')
63
- sep = str(options.SEP)
64
-
65
- new_val = f"VERSION=0.0\n\nINSTALLED_APPS = [\n{sep}'%s'\n]" % (("',\n%s'" % sep).join(apps))
66
- pre_add = '\n'.join(["if not DEBUG:",
67
- sep + "hosts = [urlparse(x) for x in os.environ.get('ALLOWED_HOST').split(',')]",
68
- sep + "ALLOWED_HOSTS = [host.hostname for host in hosts]",
69
- sep + "CSRF_TRUSTED_ORIGINS = [urlunparse(x) for x in hosts]",
70
- "else:",
71
- sep + "ALLOWED_HOSTS = ['*']"])
72
-
73
- new_val = f"{pre_add}\n\n{new_val}"
74
- new_val += "\n\nINTERNAL_IPS = (\n%s'127.0.0.1',\n)\n" % (options.SEP)
75
-
76
- fin = open(self.get_settings_file_path(), "rt", encoding='utf-8')
77
-
78
- data = fin.read()
79
- fin.close()
80
- data = re.sub(r'(from[^\n]*)', r'\g<1>\nimport os\nfrom urllib.parse import urlparse, urlunparse', data)
81
- data = re.sub(r'(ALLOWED_HOSTS[^\n]*)', r'# \g<1>', data)
82
- data = re.sub(r'INSTALLED_APPS\s*=\s*\[[^\]]+\]', new_val, data)
83
-
84
- new_val = f"DATABASES_AVAILABLE = {{\n{sep}'jest': {{'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'test_db.sqlite3', }},"
85
- data = re.sub(r'DATABASES\s*=\s*\{', new_val, data)
86
- db_pattern = self.balanced_pattern_factory('DATABASES_AVAILABLE = ')
87
- db_settings = db_pattern.search(data).group()
88
- data = db_pattern.sub(db_settings + f"\n\ndatabase = os.environ.get('DJANGO_DATABASE', 'default')\n\nDATABASES = {{'default': DATABASES_AVAILABLE[database]}}", data)
89
-
90
- data += settings_extension
91
-
92
- fout = open(self.get_settings_file_path(), "wt", encoding='utf-8')
93
- fout.write(data)
94
- fout.close()
55
+ settings_path = self.get_settings_file_path()
56
+ settings_dir = os.path.dirname(settings_path)
57
+ base_settingd_path = os.path.join(settings_dir, 'base_settings.py')
58
+ if not os.path.exists(base_settingd_path):
59
+ os.rename(settings_path, base_settingd_path)
60
+
61
+ with open(self.get_settings_file_path(), "w+", encoding='utf-8') as fout:
62
+ fout.write(settings_extension)
95
63
 
96
64
  def get_apps(self):
97
65
  self.find_and_set_project_name()
@@ -1,29 +1,18 @@
1
- import errno
2
1
  import os
3
2
  import re
3
+ from typing import Callable
4
4
 
5
5
 
6
- def makedirs_if_not_exist(directory):
7
- try:
8
- os.makedirs(directory)
9
- except OSError as e:
10
- if e.errno != errno.EEXIST:
11
- raise
12
-
13
-
14
- def copy_and_prepare(src, des, map_val):
15
- fin = open(src, "rt", encoding='utf-8')
16
-
17
- makedirs_if_not_exist(os.path.dirname(des))
18
- fout = open(des, "wt", encoding='utf-8')
19
-
20
- for line in fin:
21
- for key in map_val:
22
- line = line.replace(key, map_val[key])
23
- fout.write(line)
24
-
25
- fin.close()
26
- fout.close()
6
+ def copy_and_prepare(src, des, map_val, overwrite_handler: Callable[[str], bool] = None):
7
+ with open(src, "r", encoding='utf-8') as fin:
8
+ os.makedirs(os.path.dirname(des), exist_ok=True)
9
+ if os.path.exists(des) and (overwrite_handler is None or not overwrite_handler(f"Would you like to overwrite {des}?")):
10
+ return
11
+ with open(des, "w+", encoding='utf-8') as fout:
12
+ for line in fin:
13
+ for key in map_val:
14
+ line = line.replace(key, map_val[key])
15
+ fout.write(line)
27
16
 
28
17
 
29
18
  def prepare_as_string(src, map_val):
@@ -38,7 +27,7 @@ def prepare_as_string(src, map_val):
38
27
  return fout
39
28
 
40
29
 
41
- def copy(src, dest, map_val):
30
+ def copy(src, dest, map_val, overwrite_handler: Callable[[str], bool] = None):
42
31
  if os.path.isdir(src):
43
32
  for root, dirs, files in os.walk(src):
44
33
  if '__pycache__' in dirs:
@@ -47,12 +36,11 @@ def copy(src, dest, map_val):
47
36
  for file in files:
48
37
  copy_and_prepare(os.path.join(root, file),
49
38
  os.path.join(dest, rel_path, file),
50
- map_val)
39
+ map_val, overwrite_handler)
51
40
 
52
41
  elif os.path.exists(src):
53
42
  copy_and_prepare(src, dest,
54
- map_val)
55
-
43
+ map_val, overwrite_handler)
56
44
 
57
45
 
58
46
  def convert_to_snake_case(name):
@@ -0,0 +1,93 @@
1
+ import os
2
+ import sys
3
+
4
+ from django.core.management.base import BaseCommand, CommandError
5
+
6
+ from sdc_core.management.commands.init_add import options, settings_manager
7
+ from sdc_core.management.commands.init_add.add_controller_manager import AddControllerManager
8
+ from sdc_core.management.commands.init_add.sdc_core_manager import add_sdc_to_main_urls
9
+ from sdc_core.management.commands.init_add.utils import copy, copy_and_prepare, prepare_as_string
10
+ from sdc_core.management.commands.sdc_update_links import make_app_links
11
+
12
+
13
+ class Command(BaseCommand):
14
+ help = 'This function inits SDC in your django Project'
15
+
16
+ def add_arguments(self, parser):
17
+ parser.add_argument('-u', '--update', action='store_true',
18
+ help='The name of the new controller as snake_case')
19
+ parser.add_argument('-y', '--assume-yes',
20
+ action='store_true',
21
+ help="Automatically assume 'yes' for all prompts.")
22
+
23
+ def _yes_no_prompt(self, question: str) -> bool:
24
+ self.stdout.write(f"{question} (y/n) [default=y]")
25
+ if self._assume_yes:
26
+ return True
27
+
28
+ # Get user input
29
+ while True:
30
+ answer = input().strip().lower()
31
+ if answer in ["yes", "y"]:
32
+ return True
33
+ elif answer in ["no", "n"]:
34
+ return False
35
+ else:
36
+ self.stdout.write("Invalid input. Please enter 'yes' or 'no'.")
37
+
38
+ def handle(self, *args, **ops):
39
+ manage_py_file_path = sys.argv[0] if len(sys.argv) > 0 else 'manage.py'
40
+ update = ops.get('update', False)
41
+ self._assume_yes = ops.get('assume_yes', False)
42
+
43
+ sdc_settings = settings_manager.SettingsManager(manage_py_file_path)
44
+ sdc_settings.check_settings()
45
+
46
+ sdc_settings.find_and_set_project_name()
47
+ sdc_settings.find_and_set_whitespace_sep()
48
+
49
+ project_app_root = os.path.join(options.PROJECT_ROOT, options.PROJECT)
50
+ main_static = os.path.join(options.PROJECT_ROOT, "Assets")
51
+ main_templates = os.path.join(options.PROJECT_ROOT, "templates")
52
+
53
+ if 'sdc_tools' in sdc_settings.get_setting_vals().INSTALLED_APPS:
54
+ if not update:
55
+ raise CommandError("SimpleDomControl has initialized already! run sdc_init -u", 2)
56
+ else:
57
+ update = False
58
+ sdc_settings.update_settings(
59
+ prepare_as_string(os.path.join(options.SCRIPT_ROOT, "template_files", "settings_extension.py.txt"),
60
+ options.REPLACEMENTS))
61
+
62
+ os.makedirs(main_templates, exist_ok=True)
63
+ copy(os.path.join(options.SCRIPT_ROOT, "template_files", "Assets"), main_static, options.REPLACEMENTS,
64
+ self._yes_no_prompt)
65
+ copy(os.path.join(options.SCRIPT_ROOT, "template_files", "templates"), main_templates, options.REPLACEMENTS,
66
+ self._yes_no_prompt)
67
+
68
+ copy_and_prepare(os.path.join(options.SCRIPT_ROOT, "template_files", "routing.py.txt"),
69
+ os.path.join(project_app_root, "routing.py"),
70
+ options.REPLACEMENTS, self._yes_no_prompt)
71
+
72
+ copy_and_prepare(os.path.join(options.SCRIPT_ROOT, "template_files", "package.json"),
73
+ os.path.join(options.PROJECT_ROOT, "package.json"),
74
+ options.REPLACEMENTS, self._yes_no_prompt)
75
+
76
+ asgi_file = os.path.join(project_app_root, "asgi.py")
77
+ if os.path.exists(asgi_file):
78
+ os.remove(asgi_file)
79
+
80
+ copy_and_prepare(os.path.join(options.SCRIPT_ROOT, "template_files", "asgi.py.txt"),
81
+ asgi_file,
82
+ options.REPLACEMENTS, self._yes_no_prompt)
83
+
84
+ if not update:
85
+ add_sdc_to_main_urls(sdc_settings.get_main_url_path())
86
+ else:
87
+ for sdc_app in sdc_settings.get_sdc_apps():
88
+ AddControllerManager.add_js_app_to_organizer(sdc_app)
89
+ AddControllerManager.add_css_app_to_organizer(sdc_app)
90
+
91
+ make_app_links('sdc_tools')
92
+ make_app_links('sdc_user')
93
+
@@ -0,0 +1,23 @@
1
+ import {jest} from '@jest/globals';
2
+ import * as _sdc from 'sdc_client';
3
+ import $ from 'jquery';
4
+ import _ from 'lodash';
5
+
6
+ import { TextEncoder, TextDecoder } from 'util';
7
+
8
+ global['SCRIPT_OUTPUT'] = process.env.SCRIPT_OUTPUT.split("\n");
9
+ await new Promise(resolve => {
10
+ $.get('/').then((res) => {
11
+ for(let line of res.split('\n')) {
12
+ line = line.trim();
13
+ if(line.startsWith('window.')) {
14
+ eval(line);
15
+ }
16
+ }
17
+ resolve();
18
+ }).catch((e) => {
19
+ console.error(e);
20
+ });
21
+ });
22
+
23
+ Object.assign(global, { TextDecoder, TextEncoder, $, jest, _sdc, _});
@@ -40,6 +40,7 @@
40
40
  "license": "",
41
41
  "devDependencies": {
42
42
  "@babel/core": "^7.23.7",
43
+ "@babel/preset-env": "^7.26.0",
43
44
  "@babel/preset-react": "^7.26.3",
44
45
  "@babel/register": "^7.23.7",
45
46
  "babel-jest": "^29.7.0",
@@ -72,10 +73,10 @@
72
73
  },
73
74
  "dependencies": {
74
75
  "@popperjs/core": "^2.11.8",
75
- "bootstrap": "^5.3.2",
76
+ "bootstrap": "^5.3.3",
76
77
  "esm": "^3.2.25",
77
78
  "jquery": "^3.7.0",
78
79
  "lodash": "^4.17.21",
79
- "sdc_client": "^0.57.7"
80
+ "sdc_client": "^0.57.8"
80
81
  }
81
82
  }
@@ -0,0 +1,94 @@
1
+ """
2
+ SDC Django settings extension for §PROJECT§.
3
+
4
+ Generated by '§PROJECT§' using SDC.
5
+
6
+ For more information on this file, see
7
+ https://simpledomcontrol.readthedocs.io/en/latest/
8
+ """
9
+ import os
10
+ from urllib.parse import urlparse, urlunparse
11
+
12
+ from §PROJECT§.base_settings import *
13
+
14
+
15
+ if not DEBUG:
16
+ hosts = [urlparse(x) for x in os.environ.get('ALLOWED_HOST').split(',')]
17
+ ALLOWED_HOSTS = [host.hostname for host in hosts]
18
+ CSRF_TRUSTED_ORIGINS = [urlunparse(x) for x in hosts]
19
+ else:
20
+ ALLOWED_HOSTS = ['*']
21
+
22
+ if 'VERSION' not in locals():
23
+ VERSION = 0.0
24
+
25
+ # Add daphne amd SDC packages to installed apps
26
+ # (https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/daphne/)
27
+
28
+ INSTALLED_APPS = ['daphne'] + INSTALLED_APPS + ['channels', 'sdc_tools', 'sdc_user']
29
+
30
+ if 'INTERNAL_IPS' not in locals():
31
+ INTERNAL_IPS = (
32
+ '127.0.0.1',
33
+ )
34
+
35
+ # DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
36
+
37
+ STATIC_ROOT = BASE_DIR / 'www/'
38
+
39
+ STATICFILES_DIRS = [BASE_DIR / "static", BASE_DIR / "node_modules"]
40
+
41
+ # Set ASGI root (https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/daphne/)
42
+
43
+ ASGI_APPLICATION = '§PROJECT§.asgi.application'
44
+
45
+ # Add jest database for SDC tests
46
+
47
+ DATABASES_AVAILABLE = {
48
+ 'jest': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'test_db.sqlite3', },
49
+ } | DATABASES
50
+
51
+ database = os.environ.get('DJANGO_DATABASE', 'default')
52
+
53
+ DATABASES = {'default': DATABASES_AVAILABLE[database]}
54
+
55
+ # Setup necessary template settings for SDC
56
+
57
+ TEMPLATES[0]["APP_DIRS"] = True
58
+ if BASE_DIR / "templates" not in TEMPLATES[0]["DIRS"]:
59
+ TEMPLATES[0]["DIRS"].append(BASE_DIR / "templates")
60
+
61
+ if DEBUG:
62
+ CHANNEL_LAYERS = {
63
+ "default": {
64
+ "BACKEND": "channels.layers.InMemoryChannelLayer"
65
+ }
66
+ }
67
+ else:
68
+ CHANNEL_LAYERS = {
69
+ 'default': {
70
+ 'BACKEND': 'channels_redis.core.RedisChannelLayer',
71
+ 'CONFIG': {
72
+ "hosts": [('redis', 6379)],
73
+ },
74
+ },
75
+ }
76
+
77
+ if 'MEDIA_URL' not in locals():
78
+ MEDIA_URL = '/media/'
79
+
80
+ if 'MEDIA_ROOT' not in locals():
81
+ MEDIA_ROOT = BASE_DIR / 'media'
82
+
83
+ SERVER_CALL_VIA_WEB_SOCKET = False
84
+ MODEL_FORM_TEMPLATE = "elements/form.html"
85
+ LOGIN_CONTROLLER = 'sdc-login'
86
+ LOGIN_SUCCESS = '/'
87
+
88
+ # EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
89
+ # EMAIL_HOST =''
90
+ # EMAIL_PORT = 587
91
+ # EMAIL_HOST_USER = ''
92
+ # DEFAULT_FROM_EMAIL = ''
93
+ # EMAIL_HOST_PASSWORD = ''
94
+ # EMAIL_USE_TLS = True
@@ -1,61 +0,0 @@
1
- import os
2
- import sys
3
-
4
- from django.core.management.base import BaseCommand, CommandError
5
-
6
- from sdc_core.management.commands.init_add import options, settings_manager
7
- from sdc_core.management.commands.init_add.sdc_core_manager import add_sdc_to_main_urls, copy_apps
8
- from sdc_core.management.commands.init_add.utils import makedirs_if_not_exist, copy, copy_and_prepare, \
9
- prepare_as_string
10
- from sdc_core.management.commands.sdc_update_links import make_app_links
11
-
12
-
13
- class Command(BaseCommand):
14
- help = 'This function inits SDC in your django Project'
15
-
16
- def add_arguments(self, parser):
17
- pass
18
-
19
- def handle(self, *args, **ops):
20
- manage_py_file_path = sys.argv[0] if len(sys.argv) > 0 else 'manage.py'
21
-
22
- sdc_settings = settings_manager.SettingsManager(manage_py_file_path)
23
- sdc_settings.check_settings()
24
-
25
- sdc_settings.find_and_set_project_name()
26
- sdc_settings.find_and_set_whitespace_sep()
27
-
28
- project_app_root = os.path.join(options.PROJECT_ROOT, options.PROJECT)
29
- main_static = os.path.join(options.PROJECT_ROOT, "Assets")
30
- main_templates = os.path.join(options.PROJECT_ROOT, "templates")
31
-
32
- if 'sdc_tools' in sdc_settings.get_setting_vals().INSTALLED_APPS:
33
- raise CommandError("SimpleDomControl has initialized already!", 2)
34
-
35
-
36
- sdc_settings.update_settings(prepare_as_string(os.path.join(options.SCRIPT_ROOT, "template_files", "settings_extension.py.txt"), options.REPLACEMENTS))
37
-
38
- makedirs_if_not_exist(main_templates)
39
- copy_apps()
40
- copy(os.path.join(options.SCRIPT_ROOT, "template_files", "Assets"), main_static, options.REPLACEMENTS)
41
- copy(os.path.join(options.SCRIPT_ROOT, "template_files", "templates"), main_templates, options.REPLACEMENTS)
42
-
43
- copy_and_prepare(os.path.join(options.SCRIPT_ROOT, "template_files", "routing.py.txt"),
44
- os.path.join(project_app_root, "routing.py"),
45
- options.REPLACEMENTS)
46
-
47
- copy_and_prepare(os.path.join(options.SCRIPT_ROOT, "template_files", "package.json"),
48
- os.path.join(options.PROJECT_ROOT, "package.json"),
49
- options.REPLACEMENTS)
50
-
51
- asgi_file = os.path.join(project_app_root, "asgi.py")
52
- if os.path.exists(asgi_file):
53
- os.remove(asgi_file)
54
-
55
- copy_and_prepare(os.path.join(options.SCRIPT_ROOT, "template_files", "asgi.py.txt"),
56
- asgi_file,
57
- options.REPLACEMENTS)
58
-
59
- add_sdc_to_main_urls(sdc_settings.get_main_url_path())
60
- make_app_links('sdc_tools')
61
- make_app_links('sdc_user')
@@ -1,10 +0,0 @@
1
- import {jest} from '@jest/globals';
2
- import * as _sdc from 'sdc_client';
3
- import $ from 'jquery';
4
- import _ from 'lodash';
5
-
6
- import { TextEncoder, TextDecoder } from 'util';
7
-
8
- global['SCRIPT_OUTPUT'] = process.env.SCRIPT_OUTPUT.split("\n");
9
-
10
- Object.assign(global, { TextDecoder, TextEncoder, $, jest, _sdc, _});
@@ -1,38 +0,0 @@
1
- 1) Uncomend sdc_user in "project_app"/settings.py INSTALLED_APPS: (replace project_app by the app name of your project)
2
- ...
3
- INSTALLED_APPS = [
4
- 'django.contrib.admin',
5
- 'django.contrib.auth',
6
- 'django.contrib.contenttypes',
7
- 'django.contrib.sessions',
8
- 'django.contrib.messages',
9
- 'django.contrib.staticfiles',
10
- 'sdc_core',
11
- 'sdc_tools',
12
- 'sdc_user' # <--
13
- ]
14
-
15
- 2) Uncomend AUTH_USER_MODEL in "project_app"/settings.py INSTALLED_APPS: (replace project_app by the app name of your project)
16
- ...
17
- AUTH_USER_MODEL = 'sdc_user.CustomUser'
18
- ...
19
-
20
- 3) Uncomend the import in sdc_core/consumer.py :
21
- ...
22
- from sdc_user import sdc_views as sdc_user # <--
23
- ...
24
-
25
- 4) Uncomend the import in "project_app"/url.py: (replace project_app by the app name of your project)
26
- ...
27
- urlpatterns = [
28
- path('sdc_view/sdc_tools/', include('sdc_tools.sdc_urls')),
29
- path('sdc_view/sdc_user/', include('sdc_user.sdc_urls')), # <--
30
- # scd view below
31
- ...
32
-
33
- 5) Uncomend the import in sdc_core/static/index.organizerl.js:
34
- ...
35
- import {} from "./sdc_tools/js/sdc_tools.organizer.js"
36
- import {} from "./sdc_user/js/test_app_two.organizer.js" // <--
37
- import {app} from './simpleDomControl/sdc_main.js';
38
- ...