simpledomcontrol 0.5.0__tar.gz → 0.5.2__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.5.0 → simpledomcontrol-0.5.2}/PKG-INFO +1 -1
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/pyproject.toml +1 -1
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/consumers.py +6 -34
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/sdc_extentions/models.py +35 -2
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/package.json +1 -1
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/README.md +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/apps.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/_private.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/add_controller_manager.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/add_model_manager.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/options.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/sdc_core_manager.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/settings_manager.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/utils.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_cc.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_get_controller_infos.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_get_controller_url.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_get_model_infos.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_init.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_is_installed.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_new_model.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_shell_execute_script.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_update_links.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_update_url.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/sdc_extentions/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/sdc_extentions/forms.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/sdc_extentions/import_manager.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/sdc_extentions/response.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/sdc_extentions/search.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/sdc_extentions/views.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/.babelrc +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/gulpfile.jsx +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/src/index.organizer.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/src/index.style.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/tests/config/post-test-teardown.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/tests/config/pre-test-setup.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/tests/config/test-setup.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/webpack.config/webpack.default.config.jsx +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/webpack.config/webpack.development.config.jsx +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/webpack.config/webpack.production.config.jsx +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/apps/sdc_examples/Add_SDCUser.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/apps/sdc_examples/index.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/apps/sdc_examples/server_call.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/asgi.py.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/controller/templade_view.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/controller/template_controller.js.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/controller/template_css.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/controller/template_test.js.text +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/js_test.js.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/models/detail.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/models/list.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/routing.py.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/sdc_urls.py.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/sdc_views.py.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/settings_extension.py.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/templates/base.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/templates/index.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/urls.py.txt +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_alert_messenger/sdc_alert_messenger.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_alert_messenger/sdc_alert_messenger.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_auto_submit/sdc_auto_submit.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_detail_view/sdc_detail_view.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_detail_view/sdc_detail_view.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_dummy/sdc_dummy.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_dummy/sdc_dummy.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_error/sdc_error.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_error/sdc_error.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_list_view/sdc_list_view.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_list_view/sdc_list_view.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_model_form/sdc_model_form.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_model_form/sdc_model_form.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_navigation_client/sdc_navigation_client.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_navigator/sdc_navigator.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_navigator/sdc_navigator.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_search_view/sdc_search_view.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_search_view/sdc_search_view.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/controller/sdc_update_on_change/sdc_update_on_change.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/sdc_tools.organizer.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/src/sdc_tools/sdc_tools.style.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/Assets/tests/sdc_tools.test.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/admin.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/apps.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/migrations/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/models.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/sdc_urls.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/sdc_views.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/elements/form.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/elements/inline_form.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/email/base.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/dummy_sdc.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_alert_messenger.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_detail_view.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_dummy.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_error.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_list_view.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_model_form.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_navigator.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_search_view.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templatetags/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templatetags/addclass.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templatetags/indexfilter.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templatetags/sdc_filter.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/tests.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/views.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/controller/sdc_login/sdc_login.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/controller/sdc_login/sdc_login.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/controller/sdc_logout/sdc_logout.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/controller/sdc_logout/sdc_logout.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/controller/sdc_user_nav_btn/sdc_user_nav_btn.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/controller/sdc_user_nav_btn/sdc_user_nav_btn.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/sdc_user.organizer.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/sdc_user.style.scss +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/tests/sdc_user.test.js +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/admin.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/apps.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/migrations/__init__.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/models.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/sdc_urls.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/sdc_views.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/templates/sdc_user/sdc/sdc_login.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/templates/sdc_user/sdc/sdc_logout.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/templates/sdc_user/sdc/sdc_user_nav_btn.html +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/tests.py +0 -0
- {simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/views.py +0 -0
|
@@ -4,11 +4,9 @@ import traceback
|
|
|
4
4
|
from django.conf import settings
|
|
5
5
|
from django.core.exceptions import PermissionDenied
|
|
6
6
|
from django.core.files.uploadhandler import TemporaryFileUploadHandler
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
from django.utils.datastructures import MultiValueDict
|
|
9
9
|
from django.utils.translation import gettext as _f
|
|
10
|
-
from django.apps import apps
|
|
11
|
-
from django.db.models import FileField
|
|
12
10
|
from django.contrib.auth import get_user_model
|
|
13
11
|
from channels.generic.websocket import WebsocketConsumer
|
|
14
12
|
|
|
@@ -16,7 +14,7 @@ from asgiref.sync import async_to_sync
|
|
|
16
14
|
import importlib
|
|
17
15
|
import json
|
|
18
16
|
|
|
19
|
-
from sdc_core.sdc_extentions.models import SdcModel
|
|
17
|
+
from sdc_core.sdc_extentions.models import SdcModel, ConsumerSerializer, all_models
|
|
20
18
|
from sdc_core.sdc_extentions.response import sdc_link_factory, sdc_link_obj_factory
|
|
21
19
|
from sdc_core.sdc_extentions.import_manager import import_function
|
|
22
20
|
from sdc_core.sdc_extentions.views import SdcAccessMixin
|
|
@@ -26,12 +24,8 @@ import logging
|
|
|
26
24
|
logger = logging.getLogger(__name__)
|
|
27
25
|
User = get_user_model()
|
|
28
26
|
|
|
29
|
-
ALL_MODELS = {
|
|
30
|
-
model.__name__: model for model in apps.get_models() if hasattr(model, '__is_sdc_model__')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
27
|
importlist = []
|
|
34
|
-
|
|
28
|
+
ALL_MODELS = all_models()
|
|
35
29
|
|
|
36
30
|
class MsgManager:
|
|
37
31
|
_messages = None
|
|
@@ -71,26 +65,6 @@ class MsgManager:
|
|
|
71
65
|
'delete': {'header': f'{model} was deleted', 'msg': '{0} was changed'}}
|
|
72
66
|
|
|
73
67
|
|
|
74
|
-
class ConsumerSerializer(Serializer):
|
|
75
|
-
|
|
76
|
-
def handle_m2m_field(self, obj, field):
|
|
77
|
-
super().handle_m2m_field(obj, field)
|
|
78
|
-
self._current[field.name] = {
|
|
79
|
-
'pk': self._current[field.name],
|
|
80
|
-
'model': field.related_model.__name__,
|
|
81
|
-
'__is_sdc_model__': True
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
def _value_from_field(self, obj, field):
|
|
85
|
-
if hasattr(field, 'foreign_related_fields') and ALL_MODELS.get(
|
|
86
|
-
field.related_model.__name__) == field.related_model:
|
|
87
|
-
return {'pk': super()._value_from_field(obj, field), 'model': field.related_model.__name__,
|
|
88
|
-
'__is_sdc_model__': True}
|
|
89
|
-
if issubclass(field.__class__, FileField):
|
|
90
|
-
return field.value_from_object(obj).url
|
|
91
|
-
return super()._value_from_field(obj, field)
|
|
92
|
-
|
|
93
|
-
|
|
94
68
|
class SDCConsumer(WebsocketConsumer):
|
|
95
69
|
|
|
96
70
|
def connect(self):
|
|
@@ -220,15 +194,13 @@ class SDCModelConsumer(WebsocketConsumer):
|
|
|
220
194
|
pass
|
|
221
195
|
|
|
222
196
|
def on_update(self, data):
|
|
223
|
-
if data['
|
|
224
|
-
data['args']['data'] = ConsumerSerializer().serialize([data['args']['data']])
|
|
197
|
+
if data['pk'] in self.ids:
|
|
225
198
|
self.send(text_data=json.dumps(data))
|
|
226
199
|
|
|
227
200
|
def on_create(self, data):
|
|
228
|
-
instance = data['
|
|
201
|
+
instance = data['pk']
|
|
229
202
|
try:
|
|
230
|
-
self._load_model().get(pk=instance
|
|
231
|
-
data['args']['data'] = ConsumerSerializer().serialize([instance])
|
|
203
|
+
self._load_model().get(pk=instance)
|
|
232
204
|
self.send(text_data=json.dumps(data))
|
|
233
205
|
except:
|
|
234
206
|
pass
|
|
@@ -4,13 +4,43 @@ from django.db.models import QuerySet
|
|
|
4
4
|
from django.template.loader import render_to_string
|
|
5
5
|
from django.db.models.signals import post_save, post_delete
|
|
6
6
|
from django.dispatch.dispatcher import receiver
|
|
7
|
+
from django.core.serializers.json import Serializer
|
|
8
|
+
from django.db.models import FileField
|
|
9
|
+
from django.apps import apps
|
|
7
10
|
|
|
8
11
|
from channels.layers import get_channel_layer
|
|
9
12
|
from django.contrib.auth import get_user_model
|
|
10
13
|
|
|
11
14
|
User = get_user_model()
|
|
12
15
|
|
|
16
|
+
_ALL_MODELS = None
|
|
13
17
|
|
|
18
|
+
def all_models():
|
|
19
|
+
global _ALL_MODELS
|
|
20
|
+
if _ALL_MODELS is None:
|
|
21
|
+
_ALL_MODELS = {
|
|
22
|
+
model.__name__: model for model in apps.get_models() if hasattr(model, '__is_sdc_model__')
|
|
23
|
+
}
|
|
24
|
+
return _ALL_MODELS
|
|
25
|
+
|
|
26
|
+
class ConsumerSerializer(Serializer):
|
|
27
|
+
|
|
28
|
+
def handle_m2m_field(self, obj, field):
|
|
29
|
+
super().handle_m2m_field(obj, field)
|
|
30
|
+
self._current[field.name] = {
|
|
31
|
+
'pk': self._current[field.name],
|
|
32
|
+
'model': field.related_model.__name__,
|
|
33
|
+
'__is_sdc_model__': True
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def _value_from_field(self, obj, field):
|
|
37
|
+
if hasattr(field, 'foreign_related_fields') and all_models().get(
|
|
38
|
+
field.related_model.__name__) == field.related_model:
|
|
39
|
+
return {'pk': super()._value_from_field(obj, field), 'model': field.related_model.__name__,
|
|
40
|
+
'__is_sdc_model__': True}
|
|
41
|
+
if issubclass(field.__class__, FileField):
|
|
42
|
+
return field.value_from_object(obj).url
|
|
43
|
+
return super()._value_from_field(obj, field)
|
|
14
44
|
|
|
15
45
|
class SdcModel():
|
|
16
46
|
__is_sdc_model__ = True
|
|
@@ -51,17 +81,20 @@ class SdcModel():
|
|
|
51
81
|
@receiver(post_delete) # instead of @receiver(post_save, sender=Rebel)
|
|
52
82
|
def set_winner(sender, instance=None, created=False, **kwargs):
|
|
53
83
|
if instance is not None and hasattr(sender, '__is_sdc_model__'):
|
|
84
|
+
serialize_instance = ConsumerSerializer().serialize([instance])
|
|
54
85
|
if created:
|
|
55
86
|
async_to_sync(get_channel_layer().group_send)(sender.__name__, {
|
|
56
87
|
'event_id': 'none',
|
|
57
88
|
'type': 'on_create',
|
|
58
|
-
'
|
|
89
|
+
'pk': instance.pk,
|
|
90
|
+
'args': {'data': serialize_instance},
|
|
59
91
|
'is_error': False
|
|
60
92
|
})
|
|
61
93
|
else:
|
|
62
94
|
async_to_sync(get_channel_layer().group_send)(sender.__name__, {
|
|
63
95
|
'event_id': 'none',
|
|
64
96
|
'type': 'on_update',
|
|
65
|
-
'
|
|
97
|
+
'pk': instance.pk,
|
|
98
|
+
'args': {'data': serialize_instance},
|
|
66
99
|
'is_error': False
|
|
67
100
|
})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/options.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/init_add/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_is_installed.py
RENAMED
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_new_model.py
RENAMED
|
File without changes
|
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_update_links.py
RENAMED
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/management/commands/sdc_update_url.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
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/Assets/gulpfile.jsx
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
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/models/detail.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/settings_extension.py.txt
RENAMED
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/templates/base.html
RENAMED
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_core/template_files/templates/index.html
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
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/elements/inline_form.html
RENAMED
|
File without changes
|
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/dummy_sdc.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_dummy.html
RENAMED
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_tools/templates/sdc_tools/sdc/sdc_error.html
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
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/sdc_user.organizer.js
RENAMED
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/Assets/src/sdc_user/sdc_user.style.scss
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
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/templates/sdc_user/sdc/sdc_login.html
RENAMED
|
File without changes
|
{simpledomcontrol-0.5.0 → simpledomcontrol-0.5.2}/sdc_user/templates/sdc_user/sdc/sdc_logout.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|