arthexis 0.1.9__py3-none-any.whl → 0.1.26__py3-none-any.whl
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.
Potentially problematic release.
This version of arthexis might be problematic. Click here for more details.
- arthexis-0.1.26.dist-info/METADATA +272 -0
- arthexis-0.1.26.dist-info/RECORD +111 -0
- {arthexis-0.1.9.dist-info → arthexis-0.1.26.dist-info}/licenses/LICENSE +674 -674
- config/__init__.py +5 -5
- config/active_app.py +15 -15
- config/asgi.py +29 -29
- config/auth_app.py +7 -7
- config/celery.py +32 -25
- config/context_processors.py +67 -68
- config/horologia_app.py +7 -7
- config/loadenv.py +11 -11
- config/logging.py +59 -48
- config/middleware.py +71 -25
- config/offline.py +49 -49
- config/settings.py +676 -492
- config/settings_helpers.py +109 -0
- config/urls.py +228 -159
- config/wsgi.py +17 -17
- core/admin.py +4052 -2066
- core/admin_history.py +50 -50
- core/admindocs.py +192 -151
- core/apps.py +350 -223
- core/auto_upgrade.py +72 -0
- core/backends.py +311 -124
- core/changelog.py +403 -0
- core/entity.py +149 -133
- core/environment.py +60 -43
- core/fields.py +168 -75
- core/form_fields.py +75 -0
- core/github_helper.py +188 -25
- core/github_issues.py +183 -172
- core/github_repos.py +72 -0
- core/lcd_screen.py +78 -78
- core/liveupdate.py +25 -25
- core/log_paths.py +114 -100
- core/mailer.py +89 -83
- core/middleware.py +91 -91
- core/models.py +5041 -2195
- core/notifications.py +105 -105
- core/public_wifi.py +267 -227
- core/reference_utils.py +107 -0
- core/release.py +940 -346
- core/rfid_import_export.py +113 -0
- core/sigil_builder.py +149 -131
- core/sigil_context.py +20 -20
- core/sigil_resolver.py +250 -284
- core/system.py +1425 -230
- core/tasks.py +538 -199
- core/temp_passwords.py +181 -0
- core/test_system_info.py +202 -43
- core/tests.py +2673 -1069
- core/tests_liveupdate.py +17 -17
- core/urls.py +11 -11
- core/user_data.py +681 -495
- core/views.py +2484 -789
- core/widgets.py +213 -51
- nodes/admin.py +2236 -445
- nodes/apps.py +98 -70
- nodes/backends.py +160 -53
- nodes/dns.py +203 -0
- nodes/feature_checks.py +133 -0
- nodes/lcd.py +165 -165
- nodes/models.py +2375 -870
- nodes/reports.py +411 -0
- nodes/rfid_sync.py +210 -0
- nodes/signals.py +18 -0
- nodes/tasks.py +141 -46
- nodes/tests.py +5045 -1489
- nodes/urls.py +29 -13
- nodes/utils.py +172 -73
- nodes/views.py +1768 -304
- ocpp/admin.py +1775 -481
- ocpp/apps.py +25 -25
- ocpp/consumers.py +1843 -630
- ocpp/evcs.py +844 -928
- ocpp/evcs_discovery.py +158 -0
- ocpp/models.py +1417 -640
- ocpp/network.py +398 -0
- ocpp/reference_utils.py +42 -0
- ocpp/routing.py +11 -9
- ocpp/simulator.py +745 -368
- ocpp/status_display.py +26 -0
- ocpp/store.py +603 -403
- ocpp/tasks.py +479 -31
- ocpp/test_export_import.py +131 -130
- ocpp/test_rfid.py +1072 -540
- ocpp/tests.py +5494 -2296
- ocpp/transactions_io.py +197 -165
- ocpp/urls.py +50 -50
- ocpp/views.py +2024 -912
- pages/admin.py +1123 -396
- pages/apps.py +45 -10
- pages/checks.py +40 -40
- pages/context_processors.py +151 -85
- pages/defaults.py +13 -0
- pages/forms.py +221 -0
- pages/middleware.py +213 -153
- pages/models.py +720 -252
- pages/module_defaults.py +156 -0
- pages/site_config.py +137 -0
- pages/tasks.py +74 -0
- pages/tests.py +4009 -1389
- pages/urls.py +38 -20
- pages/utils.py +93 -12
- pages/views.py +1736 -762
- arthexis-0.1.9.dist-info/METADATA +0 -168
- arthexis-0.1.9.dist-info/RECORD +0 -92
- core/workgroup_urls.py +0 -17
- core/workgroup_views.py +0 -94
- nodes/actions.py +0 -70
- {arthexis-0.1.9.dist-info → arthexis-0.1.26.dist-info}/WHEEL +0 -0
- {arthexis-0.1.9.dist-info → arthexis-0.1.26.dist-info}/top_level.txt +0 -0
core/admin_history.py
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from django.contrib.admin.options import ModelAdmin
|
|
3
|
-
from django.contrib.admin.models import LogEntry
|
|
4
|
-
from django.utils.encoding import smart_str
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def patch_admin_history():
|
|
8
|
-
if getattr(ModelAdmin, "_history_patched", False):
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
def construct_change_message(self, request, form, formsets, add=False):
|
|
12
|
-
fields = []
|
|
13
|
-
if add:
|
|
14
|
-
for name, value in form.cleaned_data.items():
|
|
15
|
-
fields.append({"field": name, "old": None, "new": smart_str(value)})
|
|
16
|
-
if not fields:
|
|
17
|
-
return ""
|
|
18
|
-
return json.dumps({"added": fields})
|
|
19
|
-
for name in form.changed_data:
|
|
20
|
-
fields.append(
|
|
21
|
-
{
|
|
22
|
-
"field": name,
|
|
23
|
-
"old": smart_str(form.initial.get(name)),
|
|
24
|
-
"new": smart_str(form.cleaned_data.get(name)),
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
if not fields:
|
|
28
|
-
return ""
|
|
29
|
-
return json.dumps({"changed": fields})
|
|
30
|
-
|
|
31
|
-
def get_change_message(self):
|
|
32
|
-
try:
|
|
33
|
-
data = json.loads(self.change_message)
|
|
34
|
-
except Exception:
|
|
35
|
-
return self.change_message
|
|
36
|
-
if isinstance(data, dict):
|
|
37
|
-
if "added" in data:
|
|
38
|
-
parts = [f"{d['field']}='{d['new']}'" for d in data["added"]]
|
|
39
|
-
return "Added " + ", ".join(parts)
|
|
40
|
-
if "changed" in data:
|
|
41
|
-
parts = [
|
|
42
|
-
f"{d['field']}: '{d['old']}' -> '{d['new']}'"
|
|
43
|
-
for d in data["changed"]
|
|
44
|
-
]
|
|
45
|
-
return "Changed " + ", ".join(parts)
|
|
46
|
-
return self.change_message
|
|
47
|
-
|
|
48
|
-
ModelAdmin.construct_change_message = construct_change_message
|
|
49
|
-
LogEntry.get_change_message = get_change_message
|
|
50
|
-
ModelAdmin._history_patched = True
|
|
1
|
+
import json
|
|
2
|
+
from django.contrib.admin.options import ModelAdmin
|
|
3
|
+
from django.contrib.admin.models import LogEntry
|
|
4
|
+
from django.utils.encoding import smart_str
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def patch_admin_history():
|
|
8
|
+
if getattr(ModelAdmin, "_history_patched", False):
|
|
9
|
+
return
|
|
10
|
+
|
|
11
|
+
def construct_change_message(self, request, form, formsets, add=False):
|
|
12
|
+
fields = []
|
|
13
|
+
if add:
|
|
14
|
+
for name, value in form.cleaned_data.items():
|
|
15
|
+
fields.append({"field": name, "old": None, "new": smart_str(value)})
|
|
16
|
+
if not fields:
|
|
17
|
+
return ""
|
|
18
|
+
return json.dumps({"added": fields})
|
|
19
|
+
for name in form.changed_data:
|
|
20
|
+
fields.append(
|
|
21
|
+
{
|
|
22
|
+
"field": name,
|
|
23
|
+
"old": smart_str(form.initial.get(name)),
|
|
24
|
+
"new": smart_str(form.cleaned_data.get(name)),
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
if not fields:
|
|
28
|
+
return ""
|
|
29
|
+
return json.dumps({"changed": fields})
|
|
30
|
+
|
|
31
|
+
def get_change_message(self):
|
|
32
|
+
try:
|
|
33
|
+
data = json.loads(self.change_message)
|
|
34
|
+
except Exception:
|
|
35
|
+
return self.change_message
|
|
36
|
+
if isinstance(data, dict):
|
|
37
|
+
if "added" in data:
|
|
38
|
+
parts = [f"{d['field']}='{d['new']}'" for d in data["added"]]
|
|
39
|
+
return "Added " + ", ".join(parts)
|
|
40
|
+
if "changed" in data:
|
|
41
|
+
parts = [
|
|
42
|
+
f"{d['field']}: '{d['old']}' -> '{d['new']}'"
|
|
43
|
+
for d in data["changed"]
|
|
44
|
+
]
|
|
45
|
+
return "Changed " + ", ".join(parts)
|
|
46
|
+
return self.change_message
|
|
47
|
+
|
|
48
|
+
ModelAdmin.construct_change_message = construct_change_message
|
|
49
|
+
LogEntry.get_change_message = get_change_message
|
|
50
|
+
ModelAdmin._history_patched = True
|
core/admindocs.py
CHANGED
|
@@ -1,151 +1,192 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
import inspect
|
|
3
|
-
from types import SimpleNamespace
|
|
4
|
-
|
|
5
|
-
from django.apps import apps
|
|
6
|
-
from django.contrib import admin
|
|
7
|
-
from django.core.management import get_commands, load_command_class
|
|
8
|
-
from django.contrib.admindocs.views import (
|
|
9
|
-
BaseAdminDocsView,
|
|
10
|
-
user_has_model_view_permission,
|
|
11
|
-
)
|
|
12
|
-
from django.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
1
|
+
import argparse
|
|
2
|
+
import inspect
|
|
3
|
+
from types import SimpleNamespace
|
|
4
|
+
|
|
5
|
+
from django.apps import apps
|
|
6
|
+
from django.contrib import admin
|
|
7
|
+
from django.core.management import get_commands, load_command_class
|
|
8
|
+
from django.contrib.admindocs.views import (
|
|
9
|
+
BaseAdminDocsView,
|
|
10
|
+
user_has_model_view_permission,
|
|
11
|
+
)
|
|
12
|
+
from django.shortcuts import render
|
|
13
|
+
from django.template import loader
|
|
14
|
+
from django.urls import NoReverseMatch, reverse
|
|
15
|
+
from django.utils.translation import gettext_lazy as _
|
|
16
|
+
from django.test import signals as test_signals
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CommandsView(BaseAdminDocsView):
|
|
20
|
+
template_name = "admin_doc/commands.html"
|
|
21
|
+
|
|
22
|
+
def get_context_data(self, **kwargs):
|
|
23
|
+
commands = []
|
|
24
|
+
for name, app_name in sorted(get_commands().items()):
|
|
25
|
+
try:
|
|
26
|
+
cmd = load_command_class(app_name, name)
|
|
27
|
+
parser = cmd.create_parser("manage.py", name)
|
|
28
|
+
except Exception: # pragma: no cover - command import issues
|
|
29
|
+
continue
|
|
30
|
+
args = []
|
|
31
|
+
options = []
|
|
32
|
+
for action in parser._actions:
|
|
33
|
+
if isinstance(action, argparse._HelpAction):
|
|
34
|
+
continue
|
|
35
|
+
if action.option_strings:
|
|
36
|
+
options.append(
|
|
37
|
+
{
|
|
38
|
+
"opts": ", ".join(action.option_strings),
|
|
39
|
+
"help": action.help or "",
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
else:
|
|
43
|
+
args.append(
|
|
44
|
+
{
|
|
45
|
+
"name": action.metavar or action.dest,
|
|
46
|
+
"help": action.help or "",
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
commands.append(
|
|
50
|
+
{
|
|
51
|
+
"name": name,
|
|
52
|
+
"help": getattr(cmd, "help", ""),
|
|
53
|
+
"args": args,
|
|
54
|
+
"options": options,
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
return super().get_context_data(**{**kwargs, "commands": commands})
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class OrderedModelIndexView(BaseAdminDocsView):
|
|
61
|
+
template_name = "admin_doc/model_index.html"
|
|
62
|
+
|
|
63
|
+
USER_MANUALS_APP = SimpleNamespace(
|
|
64
|
+
label="manuals",
|
|
65
|
+
name="manuals",
|
|
66
|
+
verbose_name=_("User Manuals"),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
GROUP_OVERRIDES = {
|
|
70
|
+
"ocpp.location": "core",
|
|
71
|
+
"core.rfid": "ocpp",
|
|
72
|
+
"core.package": "teams",
|
|
73
|
+
"core.packagerelease": "teams",
|
|
74
|
+
"core.todo": "teams",
|
|
75
|
+
"pages.usermanual": USER_MANUALS_APP,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
def _get_docs_app_config(self, meta):
|
|
79
|
+
override = self.GROUP_OVERRIDES.get(meta.label_lower)
|
|
80
|
+
if override:
|
|
81
|
+
if isinstance(override, str):
|
|
82
|
+
return apps.get_app_config(override)
|
|
83
|
+
return override
|
|
84
|
+
return meta.app_config
|
|
85
|
+
|
|
86
|
+
def get_context_data(self, **kwargs):
|
|
87
|
+
models = []
|
|
88
|
+
for m in apps.get_models():
|
|
89
|
+
if user_has_model_view_permission(self.request.user, m._meta):
|
|
90
|
+
meta = m._meta
|
|
91
|
+
meta.docstring = inspect.getdoc(m) or ""
|
|
92
|
+
app_config = self._get_docs_app_config(meta)
|
|
93
|
+
models.append(
|
|
94
|
+
SimpleNamespace(
|
|
95
|
+
app_label=meta.app_label,
|
|
96
|
+
model_name=meta.model_name,
|
|
97
|
+
object_name=meta.object_name,
|
|
98
|
+
docstring=meta.docstring,
|
|
99
|
+
app_config=app_config,
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
models.sort(key=lambda m: str(m.app_config.verbose_name))
|
|
103
|
+
return super().get_context_data(**{**kwargs, "models": models})
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class ModelGraphIndexView(BaseAdminDocsView):
|
|
107
|
+
template_name = "admin_doc/model_graphs.html"
|
|
108
|
+
|
|
109
|
+
def render_to_response(self, context, **response_kwargs):
|
|
110
|
+
template_name = response_kwargs.pop("template_name", None)
|
|
111
|
+
if template_name is None:
|
|
112
|
+
template_name = self.get_template_names()
|
|
113
|
+
response = render(
|
|
114
|
+
self.request,
|
|
115
|
+
template_name,
|
|
116
|
+
context,
|
|
117
|
+
**response_kwargs,
|
|
118
|
+
)
|
|
119
|
+
if getattr(response, "context", None) is None:
|
|
120
|
+
response.context = context
|
|
121
|
+
if test_signals.template_rendered.receivers:
|
|
122
|
+
if isinstance(template_name, (list, tuple)):
|
|
123
|
+
template = loader.select_template(template_name)
|
|
124
|
+
else:
|
|
125
|
+
template = loader.get_template(template_name)
|
|
126
|
+
signal_context = context
|
|
127
|
+
if self.request is not None and "request" not in signal_context:
|
|
128
|
+
signal_context = {**context, "request": self.request}
|
|
129
|
+
test_signals.template_rendered.send(
|
|
130
|
+
sender=template.__class__,
|
|
131
|
+
template=template,
|
|
132
|
+
context=signal_context,
|
|
133
|
+
)
|
|
134
|
+
return response
|
|
135
|
+
|
|
136
|
+
def get_context_data(self, **kwargs):
|
|
137
|
+
sections = {}
|
|
138
|
+
user = self.request.user
|
|
139
|
+
|
|
140
|
+
for model in admin.site._registry:
|
|
141
|
+
meta = model._meta
|
|
142
|
+
if not user_has_model_view_permission(user, meta):
|
|
143
|
+
continue
|
|
144
|
+
|
|
145
|
+
app_config = apps.get_app_config(meta.app_label)
|
|
146
|
+
section = sections.setdefault(
|
|
147
|
+
app_config.label,
|
|
148
|
+
{
|
|
149
|
+
"app_label": app_config.label,
|
|
150
|
+
"verbose_name": str(app_config.verbose_name),
|
|
151
|
+
"models": [],
|
|
152
|
+
},
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
section["models"].append(
|
|
156
|
+
{
|
|
157
|
+
"object_name": meta.object_name,
|
|
158
|
+
"verbose_name": str(meta.verbose_name),
|
|
159
|
+
"doc_url": reverse(
|
|
160
|
+
"django-admindocs-models-detail",
|
|
161
|
+
kwargs={
|
|
162
|
+
"app_label": meta.app_label,
|
|
163
|
+
"model_name": meta.model_name,
|
|
164
|
+
},
|
|
165
|
+
),
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
graph_sections = []
|
|
170
|
+
for section in sections.values():
|
|
171
|
+
section_models = section["models"]
|
|
172
|
+
section_models.sort(key=lambda model: model["verbose_name"])
|
|
173
|
+
|
|
174
|
+
try:
|
|
175
|
+
app_list_url = reverse("admin:app_list", args=[section["app_label"]])
|
|
176
|
+
except NoReverseMatch:
|
|
177
|
+
app_list_url = ""
|
|
178
|
+
|
|
179
|
+
graph_sections.append(
|
|
180
|
+
{
|
|
181
|
+
**section,
|
|
182
|
+
"graph_url": reverse(
|
|
183
|
+
"admin-model-graph", args=[section["app_label"]]
|
|
184
|
+
),
|
|
185
|
+
"app_list_url": app_list_url,
|
|
186
|
+
"model_count": len(section_models),
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
graph_sections.sort(key=lambda section: section["verbose_name"])
|
|
191
|
+
|
|
192
|
+
return super().get_context_data(**{**kwargs, "sections": graph_sections})
|