plain.admin 0.22.1__py3-none-any.whl → 0.24.0__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.
- plain/admin/README.md +41 -1
- plain/admin/config.py +1 -1
- plain/admin/views/models.py +0 -33
- plain/admin/views/objects.py +2 -2
- {plain_admin-0.22.1.dist-info → plain_admin-0.24.0.dist-info}/METADATA +42 -2
- {plain_admin-0.22.1.dist-info → plain_admin-0.24.0.dist-info}/RECORD +8 -8
- {plain_admin-0.22.1.dist-info → plain_admin-0.24.0.dist-info}/WHEEL +0 -0
- {plain_admin-0.22.1.dist-info → plain_admin-0.24.0.dist-info}/licenses/LICENSE +0 -0
plain/admin/README.md
CHANGED
@@ -15,7 +15,47 @@ in addition to models.
|
|
15
15
|
## Installation
|
16
16
|
|
17
17
|
- install plain.admin and plain.htmx, add plain.admin.admin and plain.htmx to installed packages
|
18
|
-
|
18
|
+
|
19
|
+
Add the `AdminRouter` to your `urls.py`.
|
20
|
+
|
21
|
+
```python
|
22
|
+
# app/urls.py
|
23
|
+
from plain.admin.urls import AdminRouter
|
24
|
+
from plain.urls import Router, include, path
|
25
|
+
|
26
|
+
from . import views
|
27
|
+
|
28
|
+
|
29
|
+
class AppRouter(Router):
|
30
|
+
namespace = ""
|
31
|
+
urls = [
|
32
|
+
include("admin/", AdminRouter),
|
33
|
+
path("login/", views.LoginView, name="login"),
|
34
|
+
path("logout/", LogoutView, name="logout"),
|
35
|
+
# Your other urls here...
|
36
|
+
]
|
37
|
+
|
38
|
+
```
|
39
|
+
|
40
|
+
Optionally, add the admin toolbar to your base template.
|
41
|
+
|
42
|
+
```html
|
43
|
+
<!-- app/templates/base.html -->
|
44
|
+
<!DOCTYPE html>
|
45
|
+
<html lang="en">
|
46
|
+
<head>
|
47
|
+
<meta charset="UTF-8">
|
48
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
49
|
+
<title>{{ html_title|default("My App") }}</title>
|
50
|
+
{% tailwind_css %}
|
51
|
+
</head>
|
52
|
+
<body>
|
53
|
+
{% block content required %}{% endblock %}
|
54
|
+
|
55
|
+
{% toolbar %}
|
56
|
+
</body>
|
57
|
+
</html>
|
58
|
+
```
|
19
59
|
|
20
60
|
## Models in the admin
|
21
61
|
|
plain/admin/config.py
CHANGED
plain/admin/views/models.py
CHANGED
@@ -162,17 +162,6 @@ class AdminModelDetailView(AdminDetailView):
|
|
162
162
|
def get_object(self):
|
163
163
|
return self.model.objects.get(pk=self.url_kwargs["pk"])
|
164
164
|
|
165
|
-
def get_template_names(self) -> list[str]:
|
166
|
-
template_names = super().get_template_names()
|
167
|
-
|
168
|
-
if not self.template_name and isinstance(self.object, models.Model):
|
169
|
-
object_meta = self.object._meta
|
170
|
-
template_names = [
|
171
|
-
f"admin/{object_meta.package_label}/{object_meta.model_name}{self.template_name_suffix}.html"
|
172
|
-
] + template_names
|
173
|
-
|
174
|
-
return template_names
|
175
|
-
|
176
165
|
|
177
166
|
class AdminModelCreateView(AdminCreateView):
|
178
167
|
model: "models.Model"
|
@@ -191,17 +180,6 @@ class AdminModelCreateView(AdminCreateView):
|
|
191
180
|
|
192
181
|
return f"{cls.model._meta.model_name}/create/"
|
193
182
|
|
194
|
-
def get_template_names(self):
|
195
|
-
template_names = super().get_template_names()
|
196
|
-
|
197
|
-
if not self.template_name and issubclass(self.model, models.Model):
|
198
|
-
model_meta = self.model._meta
|
199
|
-
template_names = [
|
200
|
-
f"admin/{model_meta.package_label}/{model_meta.model_name}{self.template_name_suffix}.html"
|
201
|
-
] + template_names
|
202
|
-
|
203
|
-
return template_names
|
204
|
-
|
205
183
|
|
206
184
|
class AdminModelUpdateView(AdminUpdateView):
|
207
185
|
model: "models.Model"
|
@@ -224,17 +202,6 @@ class AdminModelUpdateView(AdminUpdateView):
|
|
224
202
|
def get_object(self):
|
225
203
|
return self.model.objects.get(pk=self.url_kwargs["pk"])
|
226
204
|
|
227
|
-
def get_template_names(self):
|
228
|
-
template_names = super().get_template_names()
|
229
|
-
|
230
|
-
if not self.template_name and isinstance(self.object, models.Model):
|
231
|
-
object_meta = self.object._meta
|
232
|
-
template_names = [
|
233
|
-
f"admin/{object_meta.package_label}/{object_meta.model_name}{self.template_name_suffix}.html"
|
234
|
-
] + template_names
|
235
|
-
|
236
|
-
return template_names
|
237
|
-
|
238
205
|
|
239
206
|
class AdminModelDeleteView(AdminDeleteView):
|
240
207
|
model: "models.Model"
|
plain/admin/views/objects.py
CHANGED
@@ -72,7 +72,7 @@ class AdminListView(HTMXViewMixin, AdminView):
|
|
72
72
|
|
73
73
|
if self.is_htmx_request() and not hx_from_this_page and not self._page:
|
74
74
|
# Don't render anything
|
75
|
-
return Response(
|
75
|
+
return Response(status_code=204)
|
76
76
|
|
77
77
|
return response
|
78
78
|
|
@@ -227,7 +227,7 @@ class AdminDetailView(AdminView, DetailView):
|
|
227
227
|
|
228
228
|
def get_template_names(self) -> list[str]:
|
229
229
|
return super().get_template_names() + [
|
230
|
-
"admin/detail.html",
|
230
|
+
"admin/detail.html", # A generic detail view for rendering any object
|
231
231
|
]
|
232
232
|
|
233
233
|
def get_description(self):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: plain.admin
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.24.0
|
4
4
|
Summary: Admin dashboard and tools for Plain.
|
5
5
|
Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
|
6
6
|
License-Expression: BSD-3-Clause
|
@@ -30,7 +30,47 @@ in addition to models.
|
|
30
30
|
## Installation
|
31
31
|
|
32
32
|
- install plain.admin and plain.htmx, add plain.admin.admin and plain.htmx to installed packages
|
33
|
-
|
33
|
+
|
34
|
+
Add the `AdminRouter` to your `urls.py`.
|
35
|
+
|
36
|
+
```python
|
37
|
+
# app/urls.py
|
38
|
+
from plain.admin.urls import AdminRouter
|
39
|
+
from plain.urls import Router, include, path
|
40
|
+
|
41
|
+
from . import views
|
42
|
+
|
43
|
+
|
44
|
+
class AppRouter(Router):
|
45
|
+
namespace = ""
|
46
|
+
urls = [
|
47
|
+
include("admin/", AdminRouter),
|
48
|
+
path("login/", views.LoginView, name="login"),
|
49
|
+
path("logout/", LogoutView, name="logout"),
|
50
|
+
# Your other urls here...
|
51
|
+
]
|
52
|
+
|
53
|
+
```
|
54
|
+
|
55
|
+
Optionally, add the admin toolbar to your base template.
|
56
|
+
|
57
|
+
```html
|
58
|
+
<!-- app/templates/base.html -->
|
59
|
+
<!DOCTYPE html>
|
60
|
+
<html lang="en">
|
61
|
+
<head>
|
62
|
+
<meta charset="UTF-8">
|
63
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
64
|
+
<title>{{ html_title|default("My App") }}</title>
|
65
|
+
{% tailwind_css %}
|
66
|
+
</head>
|
67
|
+
<body>
|
68
|
+
{% block content required %}{% endblock %}
|
69
|
+
|
70
|
+
{% toolbar %}
|
71
|
+
</body>
|
72
|
+
</html>
|
73
|
+
```
|
34
74
|
|
35
75
|
## Models in the admin
|
36
76
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
plain/admin/README.md,sha256=
|
1
|
+
plain/admin/README.md,sha256=tdzHNyl6-dllbkEniCg0iw9PkcqkqvdiPiKuGs8ogEQ,7225
|
2
2
|
plain/admin/__init__.py,sha256=bPv9iftT8aLqBH6dDy-HTVXW66dQUhfIiEZ-LIUMC0Y,78
|
3
|
-
plain/admin/config.py,sha256=
|
3
|
+
plain/admin/config.py,sha256=TDYmJe4UYmKw4bz0x5s9PkDa-X4V-9JoJlka162-J7M,676
|
4
4
|
plain/admin/dates.py,sha256=EEhcQhHt3-k6kE9yvPdH5X6EecmUQ259xywbDBec3Dg,10253
|
5
5
|
plain/admin/default_settings.py,sha256=j7RdgGqksCmCgPO7zCcFiVV9f8yW-EULvqDcFOhQap8,127
|
6
6
|
plain/admin/middleware.py,sha256=k3yP1o3CzvLiZZSoxqq-DvAZlp4sICRauaT-kD3FJKM,398
|
@@ -71,12 +71,12 @@ plain/admin/templates/querystats/toolbar.html,sha256=dePs614akVWUD8IlgzvQ0TREThv
|
|
71
71
|
plain/admin/templates/toolbar/toolbar.html,sha256=KcGAG6kRmx60wfqEsdD5C4nDMilH-JvPjHoU6EktfaY,5985
|
72
72
|
plain/admin/views/__init__.py,sha256=nF6AENZ3Xxyi08OTRrF6e-HYBkZSFj7XBK2mVzMYqN4,846
|
73
73
|
plain/admin/views/base.py,sha256=S1oaMUXnMOwRozbn2K-tk9tL4BMimemfMagZD9QxrJw,3512
|
74
|
-
plain/admin/views/models.py,sha256=
|
75
|
-
plain/admin/views/objects.py,sha256=
|
74
|
+
plain/admin/views/models.py,sha256=mq_c13bdTs7WQ_MShVvTo3uCy09FOlBCrGIrGeK0sEo,5946
|
75
|
+
plain/admin/views/objects.py,sha256=5rf6g6BF__YKBFmGVuatAf9PJspYrivHg86rUzv2qoY,11374
|
76
76
|
plain/admin/views/registry.py,sha256=Lxib4YSQCMHb_zACnLKymJakV8jCZPWYll7J8-aV9Xw,3712
|
77
77
|
plain/admin/views/types.py,sha256=ONMMdUoapgMoUVYgSIe-4YCdfvaVMQ4jgPWYiMo0pDk,178
|
78
78
|
plain/admin/views/viewsets.py,sha256=dqMlQ6kLn9iqd9BwBWAZT1S271wH1FdfM5HXbOgBMEw,1655
|
79
|
-
plain_admin-0.
|
80
|
-
plain_admin-0.
|
81
|
-
plain_admin-0.
|
82
|
-
plain_admin-0.
|
79
|
+
plain_admin-0.24.0.dist-info/METADATA,sha256=QOrMhB8ZOeQc79d0GIOeLgkUZ2mToAXF5kCVOE-GTMc,7662
|
80
|
+
plain_admin-0.24.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
81
|
+
plain_admin-0.24.0.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
|
82
|
+
plain_admin-0.24.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|