lino 25.8.2__py3-none-any.whl → 25.8.3__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.
Files changed (108) hide show
  1. lino/__init__.py +1 -1
  2. lino/config/unused/403.html +1 -1
  3. lino/config/unused/404.html +1 -1
  4. lino/config/unused/500.html +1 -1
  5. lino/core/actions.py +1 -1
  6. lino/core/actors.py +2 -2
  7. lino/core/elems.py +1 -1
  8. lino/core/kernel.py +5 -1
  9. lino/core/renderer.py +2 -2
  10. lino/core/requests.py +4 -5
  11. lino/core/site.py +5 -3
  12. lino/core/store.py +3 -1
  13. lino/core/urls.py +1 -1
  14. lino/help_texts.py +9 -5
  15. lino/modlib/__init__.py +1 -1
  16. lino/modlib/bootstrap5/README.txt +2 -0
  17. lino/modlib/{bootstrap3 → bootstrap5}/__init__.py +6 -6
  18. lino/modlib/{bootstrap3/config/bootstrap3 → bootstrap5/config/bootstrap5}/base.html +5 -4
  19. lino/modlib/{bootstrap3/config/bootstrap3 → bootstrap5/config/bootstrap5}/detail.html +1 -1
  20. lino/modlib/{bootstrap3/config/bootstrap3 → bootstrap5/config/bootstrap5}/index.html +1 -1
  21. lino/modlib/{bootstrap3/config/bootstrap3 → bootstrap5/config/bootstrap5}/table.html +1 -1
  22. lino/modlib/{bootstrap3 → bootstrap5}/models.py +2 -2
  23. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.css +4085 -0
  24. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.css.map +1 -0
  25. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.min.css +6 -0
  26. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.min.css.map +1 -0
  27. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.rtl.css +4084 -0
  28. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.rtl.css.map +1 -0
  29. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.rtl.min.css +6 -0
  30. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.rtl.min.css.map +1 -0
  31. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.css +597 -0
  32. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.css.map +1 -0
  33. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.min.css +6 -0
  34. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.min.css.map +1 -0
  35. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.rtl.css +594 -0
  36. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.rtl.css.map +1 -0
  37. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.rtl.min.css +6 -0
  38. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.rtl.min.css.map +1 -0
  39. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.css +5406 -0
  40. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.css.map +1 -0
  41. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.min.css +6 -0
  42. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.min.css.map +1 -0
  43. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.rtl.css +5397 -0
  44. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.rtl.css.map +1 -0
  45. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.rtl.min.css +6 -0
  46. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.rtl.min.css.map +1 -0
  47. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.css +12043 -0
  48. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.css.map +1 -0
  49. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.min.css +6 -0
  50. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.min.css.map +1 -0
  51. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.rtl.css +12016 -0
  52. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.rtl.css.map +1 -0
  53. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.rtl.min.css +6 -0
  54. lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.rtl.min.css.map +1 -0
  55. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.bundle.js +6315 -0
  56. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.bundle.js.map +1 -0
  57. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.bundle.min.js +7 -0
  58. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.bundle.min.js.map +1 -0
  59. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.esm.js +4450 -0
  60. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.esm.js.map +1 -0
  61. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.esm.min.js +7 -0
  62. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.esm.min.js.map +1 -0
  63. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.js +4497 -0
  64. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.js.map +1 -0
  65. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.min.js +7 -0
  66. lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.min.js.map +1 -0
  67. lino/modlib/{bootstrap3 → bootstrap5}/views.py +10 -10
  68. lino/modlib/comments/mixins.py +1 -8
  69. lino/modlib/comments/models.py +2 -0
  70. lino/modlib/extjs/__init__.py +1 -1
  71. lino/modlib/jinja/renderer.py +1 -1
  72. lino/modlib/memo/__init__.py +1 -2
  73. lino/modlib/odata/views.py +7 -7
  74. lino/modlib/publisher/__init__.py +9 -2
  75. lino/modlib/publisher/choicelists.py +12 -43
  76. lino/modlib/publisher/config/publisher/page.pub.html +10 -13
  77. lino/modlib/publisher/fixtures/synodalworld.py +3 -1
  78. lino/modlib/publisher/mixins.py +28 -75
  79. lino/modlib/publisher/models.py +49 -143
  80. lino/modlib/publisher/renderer.py +6 -2
  81. lino/modlib/publisher/ui.py +23 -75
  82. lino/modlib/publisher/views.py +30 -15
  83. lino/modlib/users/fixtures/abc.py +20 -0
  84. lino/modlib/users/mixins.py +6 -6
  85. lino/modlib/weasyprint/__init__.py +25 -14
  86. lino/modlib/weasyprint/config/weasyprint/base.weasy.html +43 -27
  87. {lino-25.8.2.dist-info → lino-25.8.3.dist-info}/METADATA +1 -1
  88. {lino-25.8.2.dist-info → lino-25.8.3.dist-info}/RECORD +102 -62
  89. lino/modlib/bootstrap3/README.txt +0 -2
  90. lino/modlib/bootstrap3/static/bootstrap-3.3.4/css/bootstrap.css +0 -6584
  91. lino/modlib/bootstrap3/static/bootstrap-3.3.4/css/bootstrap.css.map +0 -1
  92. lino/modlib/bootstrap3/static/bootstrap-3.3.4/css/bootstrap.min.css +0 -5
  93. lino/modlib/bootstrap3/static/bootstrap-3.3.4/js/bootstrap.js +0 -2317
  94. lino/modlib/bootstrap3/static/bootstrap-3.3.4/js/bootstrap.min.js +0 -7
  95. /lino/modlib/{bootstrap3 → bootstrap5}/renderer.py +0 -0
  96. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/css/bootstrap-theme.css +0 -0
  97. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/css/bootstrap-theme.css.map +0 -0
  98. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/css/bootstrap-theme.min.css +0 -0
  99. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.eot +0 -0
  100. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.svg +0 -0
  101. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.ttf +0 -0
  102. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.woff +0 -0
  103. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.woff2 +0 -0
  104. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/js/bootstrap_lino.js +0 -0
  105. /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/js/npm.js +0 -0
  106. {lino-25.8.2.dist-info → lino-25.8.3.dist-info}/WHEEL +0 -0
  107. {lino-25.8.2.dist-info → lino-25.8.3.dist-info}/licenses/AUTHORS.rst +0 -0
  108. {lino-25.8.2.dist-info → lino-25.8.3.dist-info}/licenses/COPYING +0 -0
@@ -1,7 +1,7 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  # Copyright 2009-2020 Rumma & Ko Ltd
3
3
  # License: GNU Affero General Public License v3 (see file COPYING for details)
4
- """Views for `lino.modlib.bootstrap3`.
4
+ """Views for `lino.modlib.bootstrap5`.
5
5
 
6
6
  """
7
7
  from past.utils import old_div
@@ -42,12 +42,12 @@ def http_response(ar, tplname, context):
42
42
  menu = MENUS.get(k, None)
43
43
  if menu is None:
44
44
  menu = settings.SITE.get_site_menu(u.user_type)
45
- bs3 = settings.SITE.plugins.bootstrap3
45
+ bs5 = settings.SITE.plugins.bootstrap5
46
46
  if False: # 20150803 home button now in base.html
47
- assert bs3.renderer is not None
48
- url = bs3.build_plain_url()
47
+ assert bs5.renderer is not None
48
+ url = bs5.build_plain_url()
49
49
  menu.add_url_button(url, label=_("Home"))
50
- e = bs3.renderer.show_menu(ar, menu)
50
+ e = bs5.renderer.show_menu(ar, menu)
51
51
  menu = tostring(e)
52
52
  MENUS[k] = menu
53
53
  context.update(menu=menu)
@@ -184,7 +184,7 @@ class List(View):
184
184
 
185
185
  def get(self, request, app_label=None, actor=None):
186
186
  ar = action_request(app_label, actor, request, request.GET, True)
187
- ar.renderer = settings.SITE.plugins.bootstrap3.renderer
187
+ ar.renderer = settings.SITE.plugins.bootstrap5.renderer
188
188
 
189
189
  context = dict(
190
190
  title=ar.get_title(),
@@ -207,7 +207,7 @@ class Element(View):
207
207
  def get(self, request, app_label=None, actor=None, pk=None):
208
208
  # print(request, app_label, actor, pk)
209
209
  ar = action_request(app_label, actor, request, request.GET, False)
210
- ar.renderer = settings.SITE.plugins.bootstrap3.renderer
210
+ ar.renderer = settings.SITE.plugins.bootstrap5.renderer
211
211
 
212
212
  navigator = None
213
213
  if pk and pk != "-99999" and pk != "-99998":
@@ -317,7 +317,7 @@ class Index(View):
317
317
  def get(self, request, *args, **kw):
318
318
  # raise Exception("20171122 {} {}".format(
319
319
  # get_language(), settings.MIDDLEWARE_CLASSES))
320
- ui = settings.SITE.plugins.bootstrap3
320
+ ui = settings.SITE.plugins.bootstrap5
321
321
  # print("20170607", request.user)
322
322
  # assert ui.renderer is not None
323
323
  ar = BaseRequest(
@@ -329,7 +329,7 @@ class Index(View):
329
329
 
330
330
 
331
331
  def index_response(ar):
332
- ui = settings.SITE.plugins.bootstrap3
332
+ ui = settings.SITE.plugins.bootstrap5
333
333
  main = settings.SITE.get_main_html(ar, front_end=ui)
334
334
  main = ui.renderer.html_text(main)
335
335
  context = dict(
@@ -341,4 +341,4 @@ def index_response(ar):
341
341
  # else:
342
342
  # user = request.subst_user or request.user
343
343
  # context.update(ar=ar)
344
- return http_response(ar, "bootstrap3/index.html", context)
344
+ return http_response(ar, "bootstrap5/index.html", context)
@@ -102,9 +102,6 @@ class Commentable(MemoReferrable):
102
102
  def get_rfc_description(self, ar):
103
103
  return ""
104
104
 
105
- # def get_comment_group(self):
106
- # return None
107
-
108
105
  if dd.is_installed("comments"):
109
106
 
110
107
  def save_new_instance(self, ar):
@@ -123,12 +120,8 @@ class Commentable(MemoReferrable):
123
120
  return _("Created new {model} {obj}.").format(
124
121
  model=self.__class__._meta.verbose_name, obj=self)
125
122
 
126
- # @classmethod
127
- # def add_comments_filter(cls, qs, ar):
128
- # return qs
129
-
130
123
  def get_comment_group(self):
131
- pass
124
+ return None # dd.plugins.groups.get_default_group()
132
125
 
133
126
  def on_create_comment(self, comment, ar):
134
127
  pass
@@ -285,8 +285,10 @@ class Comment(
285
285
  self.owner.on_create_comment(self, ar)
286
286
 
287
287
  def get_default_group(self):
288
+ # implements PrivacyRelevant
288
289
  if self.owner:
289
290
  return self.owner.get_comment_group()
291
+ return super().get_default_group()
290
292
 
291
293
  def after_ui_save(self, ar, cw):
292
294
  super().after_ui_save(ar, cw)
@@ -28,7 +28,7 @@ from django.utils.translation import gettext_lazy as _
28
28
  class Plugin(Plugin):
29
29
  """Extends :class:`lino.core.plugin.Plugin`."""
30
30
 
31
- needs_plugins = ["lino.modlib.bootstrap3"]
31
+ needs_plugins = ["lino.modlib.bootstrap5"]
32
32
 
33
33
  enter_submits_form = False
34
34
  """Whether the :kbd:`ENTER` key (or :kbd:`CTRL+ENTER` when in a
@@ -88,7 +88,7 @@ class JinjaRenderer(HtmlRenderer):
88
88
 
89
89
  def as_table2(ar):
90
90
  # 20150810
91
- # ar.renderer = settings.SITE.plugins.bootstrap3.renderer
91
+ # ar.renderer = settings.SITE.plugins.bootstrap5.renderer
92
92
  ar.renderer = self
93
93
 
94
94
  t = xghtml.Table()
@@ -46,7 +46,7 @@ class Plugin(ad.Plugin):
46
46
  front_end = None
47
47
  # front_end = 'extjs'
48
48
  # front_end = 'lino_react.react'
49
- # front_end = 'bootstrap3'
49
+ # front_end = 'bootstrap5'
50
50
  """The front end to use when writing previews.
51
51
 
52
52
  If this is `None`, Lino will use the default :term:`front end`
@@ -147,7 +147,6 @@ class Plugin(ad.Plugin):
147
147
  # break
148
148
 
149
149
  def get_patterns(self):
150
- # from django.conf.urls import url
151
150
  from django.urls import re_path as url
152
151
  from . import views
153
152
 
@@ -1,7 +1,7 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  # Copyright 2009-2017 Rumma & Ko Ltd
3
3
  # License: GNU Affero General Public License v3 (see file COPYING for details)
4
- """Views for `lino.modlib.bootstrap3`.
4
+ """Views for `lino.modlib.bootstrap5`.
5
5
 
6
6
  """
7
7
  from __future__ import division
@@ -26,14 +26,14 @@ from lino.core.requests import BaseRequest
26
26
  from lino.core.tables import AbstractTable
27
27
  from lino.core.views import action_request
28
28
  from lino.core.utils import navinfo
29
- from lino.modlib.bootstrap3.views import http_response
29
+ from lino.modlib.bootstrap5.views import http_response
30
30
  from lino.utils.html import E
31
31
 
32
32
 
33
33
  class List(View):
34
34
  def get(self, request, app_label=None, actor=None):
35
35
  ar = action_request(app_label, actor, request, request.GET, True)
36
- ar.renderer = settings.SITE.plugins.bootstrap3.renderer
36
+ ar.renderer = settings.SITE.plugins.bootstrap5.renderer
37
37
 
38
38
  context = dict(
39
39
  title=ar.get_title(),
@@ -53,7 +53,7 @@ class Element(View):
53
53
  def get(self, request, app_label=None, actor=None, pk=None):
54
54
  # print(request, app_label, actor, pk)
55
55
  ar = action_request(app_label, actor, request, request.GET, False)
56
- ar.renderer = settings.SITE.plugins.bootstrap3.renderer
56
+ ar.renderer = settings.SITE.plugins.bootstrap5.renderer
57
57
 
58
58
  navigator = None
59
59
  if pk and pk != "-99999" and pk != "-99998":
@@ -160,7 +160,7 @@ class Index(View):
160
160
  def get(self, request, *args, **kw):
161
161
  # raise Exception("20171122 {} {}".format(
162
162
  # get_language(), settings.MIDDLEWARE_CLASSES))
163
- ui = settings.SITE.plugins.bootstrap3
163
+ ui = settings.SITE.plugins.bootstrap5
164
164
  # print("20170607", request.user)
165
165
  # assert ui.renderer is not None
166
166
  ar = BaseRequest(
@@ -172,7 +172,7 @@ class Index(View):
172
172
 
173
173
 
174
174
  def index_response(ar):
175
- ui = settings.SITE.plugins.bootstrap3
175
+ ui = settings.SITE.plugins.bootstrap5
176
176
 
177
177
  main = settings.SITE.get_main_html(ar, front_end=ui)
178
178
  main = ui.renderer.html_text(main)
@@ -185,7 +185,7 @@ def index_response(ar):
185
185
  # else:
186
186
  # user = request.subst_user or request.user
187
187
  # context.update(ar=ar)
188
- return http_response(ar, "bootstrap3/index.html", context)
188
+ return http_response(ar, "bootstrap5/index.html", context)
189
189
 
190
190
 
191
191
  class Metadata(View):
@@ -10,7 +10,7 @@ class Plugin(Plugin):
10
10
  "lino.modlib.system", # 'lino.modlib.memo',
11
11
  "lino.modlib.linod",
12
12
  "lino.modlib.jinja",
13
- "lino.modlib.bootstrap3",
13
+ "lino.modlib.bootstrap5",
14
14
  ]
15
15
  locations: list[tuple[str, str]] = []
16
16
 
@@ -47,10 +47,12 @@ class Plugin(Plugin):
47
47
  for location, table_class in self.locations:
48
48
  yield url(
49
49
  f"^{location}/(?P<pk>.+)$",
50
+ # f"^{location}/<int:pk>$",
50
51
  views.Element.as_view(table_class=table_class))
51
52
 
52
53
  # Only if this is the primary front end:
53
- if self.site.kernel.web_front_ends[0] is self:
54
+ if self.site.kernel.primary_front_end is self:
55
+ # yield url("^(?P<ref>.*)$", views.Index.as_view())
54
56
  yield url("^$", views.Index.as_view())
55
57
  # yield url('^login$',views.Login.as_view())
56
58
 
@@ -63,3 +65,8 @@ class Plugin(Plugin):
63
65
  mg = self.get_menu_group()
64
66
  m = m.add_menu(mg.app_label, mg.verbose_name)
65
67
  m.add_action("publisher.SpecialPages")
68
+
69
+ def setup_explorer_menu(self, site, user_type, m, ar=None):
70
+ mg = self.get_menu_group()
71
+ m = m.add_menu(mg.app_label, mg.verbose_name)
72
+ m.add_action("publisher.RootPages")
@@ -57,42 +57,6 @@ class PublisherBuildMethod(JinjaBuildMethod):
57
57
 
58
58
  BuildMethods.add_item_instance(PublisherBuildMethod())
59
59
 
60
- # class PublisherView(dd.Choice):
61
- # table_class = None # TODO: rename this to data_view
62
- #
63
- # def __init__(self, location, table_class, text=None):
64
- # self.table_class = table_class
65
- # self.publisher_location = location
66
- # # model = dd.resolve_model(table_class.model)
67
- # # self.model = model
68
- # # value = dd.full_model_name(model)
69
- # value = str(table_class)
70
- # if text is None:
71
- # text = format_lazy("{} ({})", location, table_class)
72
- # # text = model._meta.verbose_name + ' (%s)' % dd.full_model_name(model)
73
- # # text = model._meta.verbose_name + ' (%s.%s)' % (
74
- # # text = format_lazy("{} ({})", model._meta.verbose_name, value)
75
- # # model.__module__, model.__name__)
76
- # name = None
77
- # super().__init__(value, text, name)
78
- #
79
- # def get_publisher_pages(self):
80
- # return self.table_class.model.objects.all()
81
-
82
- # class PublisherViews(dd.ChoiceList):
83
- # item_class = PublisherView
84
- # verbose_name = _("Publisher view")
85
- # verbose_name_plural = _("Publisher views")
86
- # column_names = "location value name text data_view *"
87
- #
88
- # @dd.virtualfield(models.CharField(_("Location")))
89
- # def location(cls, choice, ar):
90
- # return choice.publisher_location
91
- #
92
- # @dd.virtualfield(models.CharField(_("Data table")))
93
- # def data_view(cls, choice, ar):
94
- # return choice.table_class
95
-
96
60
 
97
61
  class PublishingState(RegistrableState):
98
62
  # is_published = False
@@ -142,14 +106,19 @@ add("40", _("Removed"), "removed", is_public=False)
142
106
  class PageFiller(Choice):
143
107
  data_view = None
144
108
 
145
- def __init__(self, data_view, *args, **kwargs):
146
- self.data_view = data_view
147
- super().__init__(str(data_view), *args, **kwargs)
109
+ def __init__(self, data_view=None, **request_params):
110
+ if data_view is not None:
111
+ self.data_view = data_view
112
+ self.request_params = request_params
113
+ super().__init__(str(self.data_view))
114
+
115
+ def create_request(self, ar, obj, **kwargs):
116
+ kwargs.update(self.request_params, parent=ar)
117
+ return self.data_view.create_request(**kwargs)
148
118
 
149
119
  def get_dynamic_story(self, ar, obj, **kwargs):
150
120
  txt = ""
151
- dv = self.data_view
152
- sar = dv.create_request(parent=ar, limit=dv.preview_limit)
121
+ sar = self.create_request(ar, obj, limit=self.data_view.preview_limit)
153
122
  # print("20231028", dv, list(sar))
154
123
  # print("20230409", ar.renderer)
155
124
  # rv += "20230325 [show {}]".format(dv)
@@ -158,9 +127,9 @@ class PageFiller(Choice):
158
127
  return txt
159
128
 
160
129
  def get_dynamic_paragraph(self, ar, obj, **kwargs):
161
- dv = self.data_view
130
+ # dv = self.data_view
162
131
  # sar = dv.create_request(parent=ar, limit=dv.preview_limit)
163
- sar = dv.create_request(parent=ar)
132
+ sar = self.create_request(ar, obj)
164
133
  return " / ".join([sar.obj2htmls(row) for row in sar])
165
134
 
166
135
 
@@ -1,4 +1,4 @@
1
- {% extends "bootstrap3/base.html" %}
1
+ {% extends "bootstrap5/base.html" %}
2
2
 
3
3
  {% block header %}
4
4
  <div class="container-fluid lino-bs-header">
@@ -39,22 +39,19 @@
39
39
  {% endblock %}
40
40
 
41
41
  {% block navbar %}
42
- <nav class="navbar navbar-default" role="navigation">
42
+ <nav class="navbar navbar-expand-lg bg-body-tertiary">
43
43
  <div class="container-fluid">
44
44
  {% set index_node, home_children = obj.home_and_children(ar) %}
45
- <div class="navbar-header">
46
- <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-navbar-collapsible-content" aria-expanded="false">
47
- <span class="sr-only">Toggle navigation</span>
48
- <span class="icon-bar"></span>
49
- <span class="icon-bar"></span>
50
- <span class="icon-bar"></span>
51
- </button>
52
- <a class="navbar-brand" href="{{ar.get_home_url()}}">{{ index_node.title }}</a>
53
- </div>
45
+ <a class="navbar-brand" href="{{ar.obj2url(index_node)}}">{{ index_node.title }}</a>
46
+ <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#bs-navbar-collapsible-content" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
47
+ <span class="navbar-toggler-icon"></span>
48
+ </button>
54
49
  <div class="collapse navbar-collapse" id="bs-navbar-collapsible-content">
55
- <ul class="nav navbar-nav">
50
+ <ul class="navbar-nav me-auto mb-2 mb-lg-0">
56
51
  {% for child in home_children %}
57
- <li>{{tostring(ar.obj2html(child))}}</li>
52
+ <li class="nav-item">
53
+ <a class="nav-link" href="{{ar.obj2url(child)}}">{{str(child)}}</a>
54
+ </li>
58
55
  {% endfor %}
59
56
  </ul>
60
57
  </div>
@@ -1,4 +1,6 @@
1
1
  from lino.api import rt, _
2
+ raise Exception("20250809 content moved to lino_book/projects/noi2/fixtures/demo.py")
3
+
2
4
 
3
5
  home_children = [
4
6
  (_("Mission"), None, []),
@@ -15,6 +17,7 @@ home_children = [
15
17
 
16
18
  def objects():
17
19
  image = rt.models.uploads.Upload.objects.first()
20
+
18
21
  def iterate(iterable):
19
22
  try:
20
23
  for obj in iterable:
@@ -25,4 +28,3 @@ def objects():
25
28
  yield obj
26
29
  for obj in rt.models.publisher.make_demo_pages(home_children):
27
30
  yield iterate(obj)
28
-
@@ -1,22 +1,20 @@
1
1
  # -*- coding: UTF-8 -*-
2
- # Copyright 2020-2023 Rumma & Ko Ltd
2
+ # Copyright 2020-2025 Rumma & Ko Ltd
3
3
  # License: GNU Affero General Public License v3 (see file COPYING for details)
4
4
 
5
5
  # from inspect import isclass
6
- from lino.utils.html import tostring
7
- from lino.api import dd, rt, _
8
-
9
6
  from django import http
10
- from django.db import models
11
- from django.conf import settings
12
- from django.utils.translation import get_language
13
- from lino.core.renderer import add_user_language
14
- from lino.core.utils import full_model_name
15
- from lino.utils import buildurl
7
+ # from django.db import models
8
+ # from django.conf import settings
9
+ # from django.utils.translation import get_language
10
+ # from lino.core.renderer import add_user_language
11
+ # from lino.core.utils import full_model_name
12
+ # from lino.utils import buildurl
16
13
  from lino.utils.html import mark_safe
17
14
  from lino.modlib.printing.mixins import Printable
18
- from lino.modlib.printing.choicelists import BuildMethods
19
- from .choicelists import PublishingStates, PageFillers
15
+ from lino.modlib.users.mixins import PrivacyRelevant
16
+ from lino.api import dd, rt, _
17
+ from .choicelists import PublishingStates, PageFillers, SpecialPages
20
18
  # from .choicelists import PublisherViews, PublishingStates
21
19
 
22
20
 
@@ -48,6 +46,10 @@ class Publishable(Printable):
48
46
  publisher_template = "publisher/page.pub.html"
49
47
  _lino_publisher_location = None
50
48
 
49
+ root_page = dd.ForeignKey(
50
+ "publisher.Page", null=True, blank=True,
51
+ verbose_name=_("Root page"), related_name='+')
52
+
51
53
  @dd.htmlbox()
52
54
  def full_page(self, ar):
53
55
  if ar is None:
@@ -65,76 +67,16 @@ class Publishable(Printable):
65
67
 
66
68
  preview_publication = PreviewPublication()
67
69
 
68
- # @classmethod
69
- # def on_analyze(cls, site):
70
- # # Inject the previous_page field to all models that have a publisher
71
- # # view.
72
- # # print("20231103", cls, [pv.table_class.model for pv in PublisherViews.get_list_items()])
73
- # # for pv in PublisherViews.get_list_items():
74
- # for loc, table_class in site.plugins.publisher.locations:
75
- # if full_model_name(cls) == table_class.model:
76
- # # print("20231103", cls)
77
- # dd.inject_field(
78
- # cls, 'previous_page',
79
- # dd.ForeignKey("self", null=True, blank=True,
80
- # verbose_name=_("Previous page")))
81
- # return
82
-
83
- # @dd.action(select_rows=False)
84
- # def preview_publication(self, ar):
85
- # sr_selected = not isclass(self)
86
- # if sr_selected:
87
- # ar.success(open_url=self.publisher_url())
88
- # else:
89
- # ar.success(open_url=self.publisher_url(self, not sr_selected))
90
-
91
- # def publisher_url(self, ar, **kw):
92
- # for i in PublisherViews.get_list_items():
93
- # if isinstance(self, i.table_class.model):
94
- # # print("20230409", self.__class__, i)
95
- # # return "/{}/{}".format(i.publisher_location, self.pk)
96
- # add_user_language(kw, ar)
97
- # # return buildurl("/" + i.publisher_location, str(self.pk), **dd.urlkwargs())
98
- # return ar.renderer.front_end.buildurl(i.publisher_location, str(self.pk), **kw)
99
- # # return dd.plugins.publisher.buildurl("/"+i.publisher_location, str(self.pk), **kw)
100
- # # return buildurl("/", i.publisher_location, str(self.pk), **kw)
101
- # available = [i.table_class.model for i in PublisherViews.get_list_items()]
102
- # return "No publisher view for {} in {}".format(self, available)
103
-
104
70
  def is_public(self):
105
71
  return True
106
72
 
107
73
  def get_preview_context(self, ar):
108
74
  return ar.get_printable_context(obj=self)
109
75
 
110
- # def set_previous_page(self, ppv, ppi):
111
- # if self.previous_page_id != ppi or self.previous_page_view != ppv:
112
- # self.previous_page_id = ppi
113
- # self.previous_page_view = ppv
114
- # self.save()
115
-
116
- # @classmethod
117
- # def update_publisher_pages(cls):
118
- # pass
119
-
120
- # def render_from(self, tplname, ar):
121
- # env = settings.SITE.plugins.jinja.renderer.jinja_env
122
- # context = self.get_preview_context(ar)
123
- # template = env.get_template(tplname)
124
- # # print("20210112 publish {} {} using {}".format(cls, obj, template))
125
- # # context = dict(obj=self, request=request, language=get_language())
126
- # return template.render(**context)
127
-
128
- def home_and_children(self, ar):
129
- home = rt.models.publisher.SpecialPages.home.get_object()
130
- return home, rt.models.publisher.Page.objects.filter(parent=home)
131
- # return dv.model.objects.filter(models.Q(parent=index_node) | models.Q(ref='index'), language=language)
132
-
133
76
  def get_publisher_response(self, ar):
134
77
  if not self.is_public():
135
78
  return http.HttpResponseNotFound(
136
- "{} {} is not public".format(self.__class__, self.pk)
137
- )
79
+ f"{self.__class__} {self.pk} is not public")
138
80
  context = self.get_preview_context(ar)
139
81
  # html = ''.join(self.as_page(ar))
140
82
  # # context.update(content=html, admin_site_prefix=dd.plugins.publisher.admin_location)
@@ -144,8 +86,16 @@ class Publishable(Printable):
144
86
  tpl.render(**context), content_type='text/html;charset="utf-8"'
145
87
  )
146
88
 
89
+ def home_and_children(self, ar):
90
+ home = self.root_page
91
+ if home is None:
92
+ home = SpecialPages.home.get_object()
93
+ return home, rt.models.publisher.Page.objects.filter(parent=home)
94
+ # return dv.model.objects.filter(models.Q(parent=index_node) | models.Q(ref='index'), language=language)
95
+
96
+
97
+ class PublishableContent(Publishable, PrivacyRelevant):
147
98
 
148
- class PublishableContent(Publishable):
149
99
  class Meta:
150
100
  abstract = True
151
101
  app_label = "publisher"
@@ -153,7 +103,8 @@ class PublishableContent(Publishable):
153
103
  language = dd.LanguageField()
154
104
  publishing_state = PublishingStates.field(default="draft")
155
105
  filler = PageFillers.field(blank=True, null=True)
156
- main_image = dd.ForeignKey('uploads.Upload', blank=True, null=True, verbose_name=_("Main image"))
106
+ main_image = dd.ForeignKey('uploads.Upload', blank=True,
107
+ null=True, verbose_name=_("Main image"))
157
108
 
158
109
  def get_print_language(self):
159
110
  return self.language
@@ -167,4 +118,6 @@ class PublishableContent(Publishable):
167
118
  super().on_duplicate(ar, master)
168
119
 
169
120
  def is_public(self):
121
+ if self.private:
122
+ return False
170
123
  return self.publishing_state.is_public