arthexis 0.1.16__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.16.dist-info → arthexis-0.1.26.dist-info}/METADATA +84 -35
- arthexis-0.1.26.dist-info/RECORD +111 -0
- config/asgi.py +1 -15
- config/middleware.py +47 -1
- config/settings.py +15 -30
- config/urls.py +53 -1
- core/admin.py +540 -450
- core/apps.py +0 -6
- core/auto_upgrade.py +19 -4
- core/backends.py +13 -3
- core/changelog.py +66 -5
- core/environment.py +4 -5
- core/models.py +1566 -203
- core/notifications.py +1 -1
- core/reference_utils.py +10 -11
- core/release.py +55 -7
- core/sigil_builder.py +2 -2
- core/sigil_resolver.py +1 -66
- core/system.py +268 -2
- core/tasks.py +174 -48
- core/tests.py +314 -16
- core/user_data.py +42 -2
- core/views.py +278 -183
- nodes/admin.py +557 -65
- nodes/apps.py +11 -0
- nodes/models.py +658 -113
- nodes/rfid_sync.py +1 -1
- nodes/tasks.py +97 -2
- nodes/tests.py +1212 -116
- nodes/urls.py +15 -1
- nodes/utils.py +51 -3
- nodes/views.py +1239 -154
- ocpp/admin.py +979 -152
- ocpp/consumers.py +268 -28
- ocpp/models.py +488 -3
- ocpp/network.py +398 -0
- ocpp/store.py +6 -4
- ocpp/tasks.py +296 -2
- ocpp/test_export_import.py +1 -0
- ocpp/test_rfid.py +121 -4
- ocpp/tests.py +950 -11
- ocpp/transactions_io.py +9 -1
- ocpp/urls.py +3 -3
- ocpp/views.py +596 -51
- pages/admin.py +262 -30
- pages/apps.py +35 -0
- pages/context_processors.py +26 -21
- pages/defaults.py +1 -1
- pages/forms.py +31 -8
- pages/middleware.py +6 -2
- pages/models.py +77 -2
- pages/module_defaults.py +5 -5
- pages/site_config.py +137 -0
- pages/tests.py +885 -109
- pages/urls.py +13 -2
- pages/utils.py +70 -0
- pages/views.py +558 -55
- arthexis-0.1.16.dist-info/RECORD +0 -111
- core/workgroup_urls.py +0 -17
- core/workgroup_views.py +0 -94
- {arthexis-0.1.16.dist-info → arthexis-0.1.26.dist-info}/WHEEL +0 -0
- {arthexis-0.1.16.dist-info → arthexis-0.1.26.dist-info}/licenses/LICENSE +0 -0
- {arthexis-0.1.16.dist-info → arthexis-0.1.26.dist-info}/top_level.txt +0 -0
arthexis-0.1.16.dist-info/RECORD
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
arthexis-0.1.16.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
2
|
-
config/__init__.py,sha256=AwpOX7il-DAOmkdJ5dVfVJ3CWWebn1lHyQNmkw1EkDw,103
|
|
3
|
-
config/active_app.py,sha256=KJqYh-o91nPQjVXPEdbiJHzsI6cN9IZsBZ9O3iZ6Hyc,373
|
|
4
|
-
config/asgi.py,sha256=T-0QSbtieEWKPIDkEcEdd-q6qjK8ZCwwjCaISOBkWdM,1296
|
|
5
|
-
config/auth_app.py,sha256=cLlKgFYV4VWsMACinKrpP-nZhXXbWZp1aj1RayDszRc,198
|
|
6
|
-
config/celery.py,sha256=c8fPkjfhKw0UQBr6FolzfdvRX2MQAV-dMokSlJ1Afgg,819
|
|
7
|
-
config/context_processors.py,sha256=p74ocuzPRFI9vKSeIaJ42Vu0V2GtGph1t-2DkRo4NMw,2449
|
|
8
|
-
config/horologia_app.py,sha256=puO_hObEYcLvE7PqcY_sGv1thnxJ018YKHKZWqNXha4,187
|
|
9
|
-
config/loadenv.py,sha256=CjXx-wBaTt1wixub4GJ5CMSMFqtiK5JURc7cPXpqO7s,287
|
|
10
|
-
config/logging.py,sha256=1cIbPgRshHuMKnVEEH0jKpRAlJSpewvLFbYDz7sCBG4,2104
|
|
11
|
-
config/middleware.py,sha256=mDU5tye8H4WCjpJqocwd0vmrzoVEYwdz9WTP4Hcr6dI,719
|
|
12
|
-
config/offline.py,sha256=X-yDcyoI4C44Y27lpkUwszY_09GwwFfazEsthKJpQ70,1382
|
|
13
|
-
config/settings.py,sha256=2ANaLD4_Vq3E84rDA2ulqK_DT_hu89Zj4ED5FVEjPBA,21427
|
|
14
|
-
config/settings_helpers.py,sha256=0BdBciUHIkwsWa0vV_RKAd4wDuEzgE7G-42XYiES4YQ,3127
|
|
15
|
-
config/urls.py,sha256=lXl2KKsbIehjOW0W6FHAsxkZJ-3DAo37f2ICb1dvvz8,5320
|
|
16
|
-
config/wsgi.py,sha256=zU_mKlya6hejQ21PxKacTui3dUWd4ca_-YJNSYAoMX0,433
|
|
17
|
-
core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
core/admin.py,sha256=c3Z5UE3cBXtJR6pQcLQYR0BWe6W7SBNvR0W9lG8b2ZU,143397
|
|
19
|
-
core/admin_history.py,sha256=XZ4b0ryufIka-xcwboK3DzmOL-INSx5Y2fJO-aJdV70,1783
|
|
20
|
-
core/admindocs.py,sha256=ycD0bJ_VE6rTGf9ebXTiKdYkD8Y8hD2oQ4HxxoBURCM,6756
|
|
21
|
-
core/apps.py,sha256=L_UMYI72-5jTo6nt8mfCbgdLhlP32D-8k76EZw0QyAA,14348
|
|
22
|
-
core/auto_upgrade.py,sha256=1EffHHFylgydWdZM_id6CppV0QqBtdNw7cwBYVdbNdk,1715
|
|
23
|
-
core/backends.py,sha256=y12jggdsn90bqBDW8L0kGy2lS8-P8Ym2PmPJ8AiPjYc,10343
|
|
24
|
-
core/changelog.py,sha256=grMvuEektkymwvkC1ubXFZF2JFopPybT82k4rUIlfmo,10840
|
|
25
|
-
core/entity.py,sha256=o4VteOXePGEsIWJFZ3fpq3DZsdWr3hpQ9A6kFbKosSE,4844
|
|
26
|
-
core/environment.py,sha256=JLcvxAwU3OTL8O6kzwcUCFNZ3T28KanHrU_4mDBFamU,1584
|
|
27
|
-
core/fields.py,sha256=d-qGahdcv4SRcO4fwCJ6_-NnEAP5xW0k3kODdAAAHSA,5412
|
|
28
|
-
core/form_fields.py,sha256=h2xT8sO8EWbznsiARkxukFk69yoW6mQwqpgonA-d6aA,2496
|
|
29
|
-
core/github_helper.py,sha256=fkjoUPwOB19zbGuk39LNLJ5AbIVKFf3rNCtnu-JISIc,5733
|
|
30
|
-
core/github_issues.py,sha256=qIygOk1ZCki0eB-9o1poJ2BnaMnbHH4ewVE36hqHUuo,5223
|
|
31
|
-
core/github_repos.py,sha256=8KCxcEiO2Ltgde7UDTAFOyHTm_eBeZYUIZegEbrjkWA,1690
|
|
32
|
-
core/lcd_screen.py,sha256=WtHMlSoZXKOsdM0d-v-f8ul-LSA6FA1bEWFwho1t6s8,2573
|
|
33
|
-
core/liveupdate.py,sha256=22m0ueQ10-6b-9pQJHY0_5WRYA98fysXKEXOWzIr550,691
|
|
34
|
-
core/log_paths.py,sha256=lxvgXPgJtVNZ-kYrqV8VFle4GFQrSxG-yRTglqvclmU,3318
|
|
35
|
-
core/mailer.py,sha256=JpW0RnD9uZ4O-wvlqeW7CMw95IFeCSkdvbankJDwHq0,2886
|
|
36
|
-
core/middleware.py,sha256=j19K9SX-Emkv7BDDtAacR9g6RWsxhKHwCc8w23JFvMM,3388
|
|
37
|
-
core/models.py,sha256=cVfk96ujtn7Re7YiHm8CU1Q_URrDjJdsEwi2-3vWyWE,124680
|
|
38
|
-
core/notifications.py,sha256=LYktoKM5k4q7YYWAJuqdeKM-p0Q-3gXgfqdq71qLS68,3916
|
|
39
|
-
core/public_wifi.py,sha256=yydLgxOo9DmJJbM4X_23wGR3gxL3YzHno54v9GssuFA,7213
|
|
40
|
-
core/reference_utils.py,sha256=jeox3V4cZNxzM2Jj31g_mdb3O55zy9S2iXAZu70R1Zc,3627
|
|
41
|
-
core/release.py,sha256=tcRddwl0_TugcmlGlTB_7gPzICfAK2wjGtdWLVg_eaE,29756
|
|
42
|
-
core/rfid_import_export.py,sha256=petyhPvL0WUpehc6uGUDUhjYQ9AVvc6O49zuhDs6YFw,3516
|
|
43
|
-
core/sigil_builder.py,sha256=VLwbrrD7Zr3SHfIDYV-V7uv7LEGiIelCSkeGswHibuc,4843
|
|
44
|
-
core/sigil_context.py,sha256=GCzjfM6fcVvBtSbVNfmE6sx3HU8QnxnXrCIytnNpQzM,439
|
|
45
|
-
core/sigil_resolver.py,sha256=rCsypuX-0oWNfKyM1T9ZLWHY0Ezwhtk4VmI0L3krnsE,11098
|
|
46
|
-
core/system.py,sha256=KRIvgEr0XwzdWuvLXmOsK43WRjPoDEuOvPn2nhVz0s4,35704
|
|
47
|
-
core/tasks.py,sha256=PiZ5qKngXP8Q3rVEn_l9zCQ-9tx4Z8v7-t0l5fHnMvA,12535
|
|
48
|
-
core/temp_passwords.py,sha256=FieUnIUeQHmA1DoXvfJ5U6-Ayv3oDz-hSln5s_vNbA4,5271
|
|
49
|
-
core/test_system_info.py,sha256=IMPz21KEs6OC5YbL7YaIBdmJVLjRY6MgPuZpldJB5OI,6935
|
|
50
|
-
core/tests.py,sha256=J1ttP5u3UdU242NBoYIfbnpFVzJsmLNI671ChgQQuik,93782
|
|
51
|
-
core/tests_liveupdate.py,sha256=IquU8ztk6zbzC1bQu3Nrr3RzGzuujtPwDkANJHbxg98,510
|
|
52
|
-
core/urls.py,sha256=YPippON1MAP2KeZZ8jHpcLO6mvbnKn1q7fdMv5Vm9dY,425
|
|
53
|
-
core/user_data.py,sha256=02CfvxayELWSWZJCxWpv1Yz7EGg08yEu5MM31Khsi0U,21083
|
|
54
|
-
core/views.py,sha256=N47qQFwSSm0gCKRf2oKJIrYVESt0BIIqnTNh4wMlf6s,85237
|
|
55
|
-
core/widgets.py,sha256=vlR9PlFfZGlkHm5X2cqNXuEBZSj8gmWaR6MO1mMy6kg,6904
|
|
56
|
-
core/workgroup_urls.py,sha256=XR9IqwsSBI8epW7_-hHhWFU9wsyJfZehHwNQBhCgmpM,407
|
|
57
|
-
core/workgroup_views.py,sha256=vtumF3-8YaTD-K6nSd8eYvUyq3ftpvWSEwtcp5B-P6o,2889
|
|
58
|
-
nodes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
|
-
nodes/admin.py,sha256=liGwvusPI3o0RAxhamA8Hs1CMev_DRiFbbNhHWNqIfk,62079
|
|
60
|
-
nodes/apps.py,sha256=AxK-sh9JBJZwNOLjqw9omCQGUQWw-45VRdYH07XhVJU,2732
|
|
61
|
-
nodes/backends.py,sha256=dmmbS0X2YIlCDz2KjoDf_L62dy--nuqZF1rEDoi2JHM,5921
|
|
62
|
-
nodes/dns.py,sha256=D5smXD7Rkh6E4MdL6TBL2WY8GgJg7Rx9z88LZrcMbTw,7048
|
|
63
|
-
nodes/feature_checks.py,sha256=27e4PCkZ8BGWnJCOwMcY2Bo9z7LoeZWiTZuISWGnrzk,3996
|
|
64
|
-
nodes/lcd.py,sha256=iKA8Wmq85KZD52aTzAU8ZmS144_gbdGMOXcE8yuECps,5758
|
|
65
|
-
nodes/models.py,sha256=1aoifwRm_VHhYCcP4i7P7ZbiDFRLQkTO57FozknWd9A,62840
|
|
66
|
-
nodes/reports.py,sha256=NRYh3Y0SlZFhx31Zh2K03yO12ZrpxEHEY6T-dODA6WE,12059
|
|
67
|
-
nodes/rfid_sync.py,sha256=SP_BRUhgYMBH-zXrcM7uShgFSGYmmuIMb1OdcU1e-5U,6956
|
|
68
|
-
nodes/signals.py,sha256=PtOKdQfb08mV1LgSZvn7ZAcfOyy2c3Xkq4AOpBQyUdE,622
|
|
69
|
-
nodes/tasks.py,sha256=ur59ebu9z02idmvy_IvUQt3eu9LWRyyNpkg2szvIHCQ,1522
|
|
70
|
-
nodes/tests.py,sha256=deqjQVAt6sXyI_DdY9zj-Ha3ad1TlnVbhjGhJ-LFqKg,155932
|
|
71
|
-
nodes/urls.py,sha256=HmAxj6sr6nMf0lii_1UX7sNBJUcrkaiKm3R9ofUWhvM,677
|
|
72
|
-
nodes/utils.py,sha256=wt7UuSXGuq79A-g-B6EW3kK49QWJBb7zhhkw4pun4k8,4474
|
|
73
|
-
nodes/views.py,sha256=TyW7exkVaR-o2_XkJXSi9jQ_BygXOE2cQFs4xlI20Xc,22905
|
|
74
|
-
ocpp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
75
|
-
ocpp/admin.py,sha256=9rmECU832lpD7Hcb4_6pkLmQ1D_y9Q6Xl9n8pa3ux8c,31449
|
|
76
|
-
ocpp/apps.py,sha256=i3NqrmIamNEQBT33CIqh7HOSOPmJXCMKrZ-DUd3whqg,842
|
|
77
|
-
ocpp/consumers.py,sha256=LgplrJQOfs8CKCtmBcRQLcDVB4Tz7YZpb3I7r2lAorQ,66352
|
|
78
|
-
ocpp/evcs.py,sha256=q1mZrCVSZxXTrtYsDqH6lkeEcJ6tfSC7p9YxkDmpSCw,28883
|
|
79
|
-
ocpp/evcs_discovery.py,sha256=OmrzgaOHwveDRJs8AIhrM3apX8_k2PPXh_oYaYpNW3c,3876
|
|
80
|
-
ocpp/models.py,sha256=QjEaygY7Tl47Q6z2uxP6ftUn4JeD8-JQX2fcwrCaEEg,31631
|
|
81
|
-
ocpp/reference_utils.py,sha256=_UR82GfE93kv4766mHyVIfdhhyYvrT59660r3H6W55M,1072
|
|
82
|
-
ocpp/routing.py,sha256=3kQya-MdJ00778xDmX0esQLBP05P200V45asg-CGNoo,438
|
|
83
|
-
ocpp/simulator.py,sha256=vnyd59QffT79AaPhmfM_jipni_nqfG57X5tXyx1rBoc,28016
|
|
84
|
-
ocpp/status_display.py,sha256=YGFosd5HJETA0DcLdsjvx6EfhZSnI8Aa3cMnHG2WsBE,939
|
|
85
|
-
ocpp/store.py,sha256=rHrP2Iq2ycMFbal1UEJVXb7r4gDtI5yifaE3nT0tjJw,18855
|
|
86
|
-
ocpp/tasks.py,sha256=OxIaI4OSLz9AfwLexnXhiBILBimTs3gVrPd197Jguqg,5819
|
|
87
|
-
ocpp/test_export_import.py,sha256=Zp6xUBlRq7XkdKjOs78BhkujNQdklxi4RLxU8c-udWY,4530
|
|
88
|
-
ocpp/test_rfid.py,sha256=1DeIfE9diIOV8kJoVH_5HYLOpv6GWQt7_SbZfFlpBZw,34690
|
|
89
|
-
ocpp/tests.py,sha256=2pa6Vw5aMe-ak3LthHyo5jJmibD8I_BpFOapBwWkEdo,177608
|
|
90
|
-
ocpp/transactions_io.py,sha256=YnxI-Tv5UFxv0JuFK3XpoqFYP8eRT8sMuDiqkiMHPtU,7387
|
|
91
|
-
ocpp/urls.py,sha256=3T5O5DSwVk4PbhPx5p4D3UseCWvC5xV5HwJLSM6AfA8,1700
|
|
92
|
-
ocpp/views.py,sha256=LE2mqB5FTno4SYzBWabu9g95o77Ojo2uFtTG6K5W9F0,56311
|
|
93
|
-
pages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
94
|
-
pages/admin.py,sha256=f2IYr-nGg9FmafQfDmIRrv01UuXh4mdhFJbnw-ytzHU,27459
|
|
95
|
-
pages/apps.py,sha256=AzUNXQX0yRUX5jus-5EDReDb0nOEY8DBgYaM970u6Io,288
|
|
96
|
-
pages/checks.py,sha256=sM8_hUVM_HOIocvtTb2sY3AaSEvbTnOlO46UchGVd-0,1527
|
|
97
|
-
pages/context_processors.py,sha256=oINGTI0owXz60FV-XFEjnTkY2xlSDE-W6X1TK8IK800,5072
|
|
98
|
-
pages/defaults.py,sha256=l36APPAZO4ub2A8Pp-lQGujKeOVYcyzU6t7-kOk8VoA,522
|
|
99
|
-
pages/forms.py,sha256=T0atqxdNds3IBP8N-9c5-ACf3iR9FzzmhzK4MOa24e8,7058
|
|
100
|
-
pages/middleware.py,sha256=6PMLiyuHAHbfLeHwwQxIVy2fJ32ramEO9SHAN05Set4,6967
|
|
101
|
-
pages/models.py,sha256=Sp8e2VB5a7yg4eSUlz_VcsSlAuDVap26xBKYYggxmLM,20952
|
|
102
|
-
pages/module_defaults.py,sha256=R8n6eQDjNRMpO-DW86OFGvyRarju5Bx7Fnb275R_z24,5411
|
|
103
|
-
pages/tasks.py,sha256=ivcba_3wSQ1-cku0oDplzw6vLeQ9hBq3R4TG-LmR5gs,1913
|
|
104
|
-
pages/tests.py,sha256=-4EAtsfW3rmAVOCHaq6X_2rqLj0QEXkvJ5Lr3fY3QRw,125124
|
|
105
|
-
pages/urls.py,sha256=Ne6yYJxgUAMieDpppJ149E-yh-oVi92fARiRPe-n4-s,1166
|
|
106
|
-
pages/utils.py,sha256=CR4D1debgJLGgXsw9kap2ggpe7fIpSoWS_ivbgMNp2k,564
|
|
107
|
-
pages/views.py,sha256=Ye7qGlO7IwkZO0oR1SzCpkEDTtGCJPmDJT-x6QQ8vaQ,45848
|
|
108
|
-
arthexis-0.1.16.dist-info/METADATA,sha256=hQmESfUjXmKX-Sp0jIX99El92v5Q691UVjNobBUflWg,9998
|
|
109
|
-
arthexis-0.1.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
110
|
-
arthexis-0.1.16.dist-info/top_level.txt,sha256=J2a2q8_BWrCZ8H2WFUNMBfO2jz8j2gax6zZh-_1QDac,29
|
|
111
|
-
arthexis-0.1.16.dist-info/RECORD,,
|
core/workgroup_urls.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"""URL routes for assistant profile endpoints."""
|
|
2
|
-
|
|
3
|
-
from django.urls import path
|
|
4
|
-
|
|
5
|
-
from . import workgroup_views as views
|
|
6
|
-
|
|
7
|
-
app_name = "workgroup"
|
|
8
|
-
|
|
9
|
-
urlpatterns = [
|
|
10
|
-
path(
|
|
11
|
-
"assistant-profiles/<int:user_id>/",
|
|
12
|
-
views.issue_key,
|
|
13
|
-
name="assistantprofile-issue",
|
|
14
|
-
),
|
|
15
|
-
path("assistant/test/", views.assistant_test, name="assistant-test"),
|
|
16
|
-
path("chat/", views.chat, name="chat"),
|
|
17
|
-
]
|
core/workgroup_views.py
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"""REST endpoints for AssistantProfile issuance and authentication."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from functools import wraps
|
|
6
|
-
|
|
7
|
-
from django.apps import apps
|
|
8
|
-
from django.contrib.auth import get_user_model
|
|
9
|
-
from django.forms.models import model_to_dict
|
|
10
|
-
from django.http import HttpResponse, JsonResponse
|
|
11
|
-
from django.views.decorators.csrf import csrf_exempt
|
|
12
|
-
from django.views.decorators.http import require_GET, require_POST
|
|
13
|
-
|
|
14
|
-
from .models import AssistantProfile, hash_key
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@csrf_exempt
|
|
18
|
-
@require_POST
|
|
19
|
-
def issue_key(request, user_id: int) -> JsonResponse:
|
|
20
|
-
"""Issue a new ``user_key`` for ``user_id``.
|
|
21
|
-
|
|
22
|
-
The response reveals the plain key once. Store only the hash server-side.
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
user = get_user_model().objects.get(pk=user_id)
|
|
26
|
-
profile, key = AssistantProfile.issue_key(user)
|
|
27
|
-
return JsonResponse({"user_id": user_id, "user_key": key})
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def authenticate(view_func):
|
|
31
|
-
"""View decorator that validates the ``Authorization`` header."""
|
|
32
|
-
|
|
33
|
-
@wraps(view_func)
|
|
34
|
-
def wrapper(request, *args, **kwargs):
|
|
35
|
-
header = request.META.get("HTTP_AUTHORIZATION", "")
|
|
36
|
-
if not header.startswith("Bearer "):
|
|
37
|
-
return HttpResponse(status=401)
|
|
38
|
-
|
|
39
|
-
key_hash = hash_key(header.split(" ", 1)[1])
|
|
40
|
-
try:
|
|
41
|
-
profile = AssistantProfile.objects.get(
|
|
42
|
-
user_key_hash=key_hash, is_active=True
|
|
43
|
-
)
|
|
44
|
-
except AssistantProfile.DoesNotExist:
|
|
45
|
-
return HttpResponse(status=401)
|
|
46
|
-
|
|
47
|
-
profile.touch()
|
|
48
|
-
request.assistant_profile = profile
|
|
49
|
-
request.chat_profile = profile
|
|
50
|
-
return view_func(request, *args, **kwargs)
|
|
51
|
-
|
|
52
|
-
return wrapper
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@require_GET
|
|
56
|
-
@authenticate
|
|
57
|
-
def assistant_test(request):
|
|
58
|
-
"""Return a simple greeting to confirm authentication."""
|
|
59
|
-
|
|
60
|
-
profile = getattr(request, "assistant_profile", None)
|
|
61
|
-
user_id = profile.user_id if profile else None
|
|
62
|
-
return JsonResponse({"message": f"Hello from user {user_id}"})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@require_GET
|
|
66
|
-
@authenticate
|
|
67
|
-
def chat(request):
|
|
68
|
-
"""Return serialized data from any model.
|
|
69
|
-
|
|
70
|
-
Clients must provide ``model`` as ``app_label.ModelName`` and may include a
|
|
71
|
-
``pk`` to fetch a specific record. When ``pk`` is omitted, the view returns
|
|
72
|
-
up to 100 records.
|
|
73
|
-
"""
|
|
74
|
-
|
|
75
|
-
model_label = request.GET.get("model")
|
|
76
|
-
if not model_label:
|
|
77
|
-
return JsonResponse({"error": "model parameter required"}, status=400)
|
|
78
|
-
try:
|
|
79
|
-
model = apps.get_model(model_label)
|
|
80
|
-
except LookupError:
|
|
81
|
-
return JsonResponse({"error": "unknown model"}, status=400)
|
|
82
|
-
|
|
83
|
-
qs = model.objects.all()
|
|
84
|
-
pk = request.GET.get("pk")
|
|
85
|
-
if pk is not None:
|
|
86
|
-
try:
|
|
87
|
-
obj = qs.get(pk=pk)
|
|
88
|
-
except model.DoesNotExist:
|
|
89
|
-
return JsonResponse({"error": "object not found"}, status=404)
|
|
90
|
-
data = model_to_dict(obj)
|
|
91
|
-
else:
|
|
92
|
-
data = [model_to_dict(o) for o in qs[:100]]
|
|
93
|
-
|
|
94
|
-
return JsonResponse({"data": data})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|