django-content-studio 1.0.0b11__py3-none-any.whl → 1.0.0b12__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.
@@ -1,5 +1,5 @@
1
1
  __title__ = "Django Content Studio"
2
- __version__ = "1.0.0-beta.11"
2
+ __version__ = "1.0.0-beta.12"
3
3
  __author__ = "Leon van der Grient"
4
4
  __license__ = "MIT"
5
5
 
content_studio/admin.py CHANGED
@@ -37,6 +37,8 @@ class AdminSite(admin.AdminSite):
37
37
 
38
38
  model_groups = None
39
39
 
40
+ extensions = None
41
+
40
42
  default_widget_mapping = {
41
43
  models.CharField: widgets.InputWidget,
42
44
  models.IntegerField: widgets.InputWidget,
@@ -0,0 +1,69 @@
1
+ import uuid
2
+
3
+
4
+ class BaseExtension:
5
+ extension_type: str
6
+ extension_id: uuid.UUID
7
+
8
+ def __init__(self):
9
+ self.extension_id = uuid.uuid4()
10
+
11
+ def serialize(self):
12
+ return {
13
+ "extension_type": self.extension_type,
14
+ "extension_id": str(self.extension_id),
15
+ }
16
+
17
+
18
+ class MainMenuLink(BaseExtension):
19
+ extension_type = "MainMenuLink"
20
+ url: str
21
+ label: str
22
+ icon: str = None
23
+ color: str = None
24
+ weight: int = 0
25
+
26
+ def __init__(
27
+ self, url: str, label: str, icon: str = None, color: str = None, weight: int = 0
28
+ ):
29
+ self.url = url
30
+ self.label = label
31
+ self.icon = icon
32
+ self.color = color
33
+ self.weight = weight
34
+ super().__init__()
35
+
36
+ def serialize(self):
37
+ return {
38
+ **super().serialize(),
39
+ "config": {
40
+ "url": self.url,
41
+ "icon": self.icon,
42
+ "color": self.color,
43
+ "label": self.label,
44
+ },
45
+ }
46
+
47
+
48
+ class IFramePage(BaseExtension):
49
+ extension_type = "IFramePage"
50
+ path: str
51
+ iframe_url: str
52
+
53
+ def __init__(
54
+ self,
55
+ path: str,
56
+ iframe_url: str,
57
+ ):
58
+ self.path = path
59
+ self.iframe_url = iframe_url
60
+ super().__init__()
61
+
62
+ def serialize(self):
63
+ return {
64
+ **super().serialize(),
65
+ "config": {
66
+ "path": self.path,
67
+ "iframe_url": self.iframe_url,
68
+ },
69
+ }