lino 25.3.1__py3-none-any.whl → 25.3.2__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.
- lino/__init__.py +6 -7
- lino/api/dd.py +1 -0
- lino/api/doctest.py +3 -68
- lino/api/rt.py +2 -4
- lino/core/actors.py +22 -16
- lino/core/boundaction.py +17 -7
- lino/core/dashboard.py +5 -4
- lino/core/dbtables.py +15 -16
- lino/core/fields.py +3 -3
- lino/core/menus.py +1 -1
- lino/core/model.py +1 -1
- lino/core/renderer.py +10 -11
- lino/core/requests.py +11 -7
- lino/core/tables.py +2 -2
- lino/core/utils.py +3 -3
- lino/core/views.py +3 -3
- lino/help_texts.py +1 -0
- lino/management/commands/buildsite.py +57 -0
- lino/management/commands/initdb.py +12 -14
- lino/mixins/sequenced.py +1 -1
- lino/modlib/comments/models.py +1 -1
- lino/modlib/comments/ui.py +2 -2
- lino/modlib/extjs/ext_renderer.py +2 -2
- lino/modlib/extjs/views.py +50 -48
- lino/modlib/help/config/makehelp/model.tpl.rst +1 -1
- lino/modlib/help/management/commands/makehelp.py +6 -5
- lino/modlib/jinja/renderer.py +2 -2
- lino/modlib/linod/management/commands/linod.py +5 -2
- lino/modlib/memo/__init__.py +1 -1
- lino/modlib/publisher/choicelists.py +3 -3
- lino/modlib/publisher/views.py +2 -2
- lino/modlib/search/models.py +5 -5
- lino/modlib/system/choicelists.py +6 -3
- lino/modlib/tinymce/views.py +1 -1
- lino/modlib/uploads/models.py +1 -1
- lino/modlib/users/ui.py +2 -3
- lino/utils/__init__.py +4 -1
- lino/utils/diag.py +1 -1
- lino/utils/fieldutils.py +79 -0
- {lino-25.3.1.dist-info → lino-25.3.2.dist-info}/METADATA +1 -1
- {lino-25.3.1.dist-info → lino-25.3.2.dist-info}/RECORD +44 -42
- {lino-25.3.1.dist-info → lino-25.3.2.dist-info}/WHEEL +0 -0
- {lino-25.3.1.dist-info → lino-25.3.2.dist-info}/licenses/AUTHORS.rst +0 -0
- {lino-25.3.1.dist-info → lino-25.3.2.dist-info}/licenses/COPYING +0 -0
lino/__init__.py
CHANGED
@@ -26,7 +26,12 @@ defines no models, some template files, a series of :term:`django-admin commands
|
|
26
26
|
|
27
27
|
"""
|
28
28
|
|
29
|
-
|
29
|
+
from django.utils.translation import gettext_lazy as _
|
30
|
+
from django import VERSION
|
31
|
+
from django.apps import AppConfig
|
32
|
+
from django.conf import settings
|
33
|
+
import warnings
|
34
|
+
__version__ = '25.3.2'
|
30
35
|
|
31
36
|
# import setuptools # avoid UserWarning "Distutils was imported before Setuptools"?
|
32
37
|
|
@@ -60,7 +65,6 @@ elif sys.version_info[0] == 2 and sys.version_info[1] > 6:
|
|
60
65
|
else:
|
61
66
|
PYAFTER26 = False
|
62
67
|
|
63
|
-
import warnings
|
64
68
|
|
65
69
|
warnings.filterwarnings(
|
66
70
|
"error",
|
@@ -92,8 +96,6 @@ warnings.filterwarnings(
|
|
92
96
|
# TODO: get everything to work even when ResourceWarning gives an error
|
93
97
|
# warnings.filterwarnings("error", category=ResourceWarning)
|
94
98
|
|
95
|
-
from django.conf import settings
|
96
|
-
from django.apps import AppConfig
|
97
99
|
|
98
100
|
# def setup_project(settings_module):
|
99
101
|
# os.environ['DJANGO_SETTINGS_MODULE'] = settings_module
|
@@ -110,8 +112,6 @@ def assert_django_code(django_code):
|
|
110
112
|
)
|
111
113
|
|
112
114
|
|
113
|
-
from django import VERSION
|
114
|
-
|
115
115
|
AFTER17 = True
|
116
116
|
AFTER18 = True
|
117
117
|
DJANGO2 = True
|
@@ -197,4 +197,3 @@ class AppConfig(AppConfig):
|
|
197
197
|
default_app_config = "lino.AppConfig"
|
198
198
|
|
199
199
|
# deprecated use, only for backwards compat:
|
200
|
-
from django.utils.translation import gettext_lazy as _
|
lino/api/dd.py
CHANGED
@@ -10,6 +10,7 @@ from lino.modlib.system.choicelists import Genders, PeriodEvents, YesNo
|
|
10
10
|
from lino.utils.mldbc.fields import BabelCharField, LanguageField
|
11
11
|
from lino.utils.mldbc.fields import BabelTextField
|
12
12
|
from lino.utils.format_date import fdl as dtosl
|
13
|
+
from lino.utils.fieldutils import get_fields, fields_help
|
13
14
|
from lino import logger
|
14
15
|
|
15
16
|
# import logging ; logger = logging.getLogger(__name__)
|
lino/api/doctest.py
CHANGED
@@ -14,12 +14,11 @@ tested document. It includes
|
|
14
14
|
|
15
15
|
"""
|
16
16
|
|
17
|
+
from lino.utils.fieldutils import get_fields, fields_help
|
17
18
|
from lino.core.boundaction import BoundAction
|
18
19
|
from lino.core.tables import AbstractTable
|
19
20
|
from lino.core.actions import Action
|
20
21
|
from django.db.models import Model
|
21
|
-
from lino.core.layouts import BaseLayout
|
22
|
-
from lino.core.actions import register_params
|
23
22
|
from lino.core.actions import ShowTable
|
24
23
|
from lino.core.menus import Menu
|
25
24
|
from lino.utils.html import html2text
|
@@ -92,7 +91,8 @@ def get_json_dict(username, uri, an="detail", **kwargs):
|
|
92
91
|
# url += "&{}={}".format(k, v)
|
93
92
|
test_client.force_login(rt.login(username).user)
|
94
93
|
res = test_client.get(url, REMOTE_USER=username)
|
95
|
-
|
94
|
+
if res.status_code != 200:
|
95
|
+
raise Exception(f"GET {url} got status code {res.status_code}")
|
96
96
|
s = res.content.decode()
|
97
97
|
try:
|
98
98
|
return json.loads(s)
|
@@ -318,71 +318,6 @@ def show_workflow(actions, all=False, language=None):
|
|
318
318
|
return doit()
|
319
319
|
|
320
320
|
|
321
|
-
def get_fields(model, fieldnames=None, columns=None):
|
322
|
-
if isinstance(model, BoundAction):
|
323
|
-
get_field = model.action.parameters.get
|
324
|
-
if fieldnames is None:
|
325
|
-
fieldnames = model.action.params_layout
|
326
|
-
elif isinstance(model, Action):
|
327
|
-
get_field = model.parameters.get
|
328
|
-
if fieldnames is None:
|
329
|
-
fieldnames = model.params_layout.main
|
330
|
-
elif issubclass(model, Model):
|
331
|
-
get_field = model._meta.get_field
|
332
|
-
# get_field = model.get_data_elem
|
333
|
-
if fieldnames is None:
|
334
|
-
fieldnames = [f.name for f in model._meta.get_fields()]
|
335
|
-
elif issubclass(model, AbstractTable):
|
336
|
-
if columns:
|
337
|
-
get_field = model.get_data_elem
|
338
|
-
if fieldnames is None:
|
339
|
-
fieldnames = model.column_names
|
340
|
-
# get_handle().grid_layout.main.columns
|
341
|
-
else:
|
342
|
-
get_field = model.parameters.get
|
343
|
-
if fieldnames is None:
|
344
|
-
if not isinstance(model.params_layout, BaseLayout):
|
345
|
-
register_params(model)
|
346
|
-
fieldnames = model.params_layout.main
|
347
|
-
if fieldnames is None:
|
348
|
-
return
|
349
|
-
if isinstance(fieldnames, str):
|
350
|
-
fieldnames = fieldnames.split()
|
351
|
-
for n in fieldnames:
|
352
|
-
yield get_field(n)
|
353
|
-
|
354
|
-
|
355
|
-
def fields_help(model, fieldnames=None, columns=False, all=None):
|
356
|
-
"""
|
357
|
-
Print an overview description of the specified fields of the
|
358
|
-
specified model.
|
359
|
-
|
360
|
-
If model is an action or table, print the parameter fields of that
|
361
|
-
action or table.
|
362
|
-
|
363
|
-
If model is a table and you want the columns instead of the
|
364
|
-
parameter fields, then specify `columns=True`.
|
365
|
-
|
366
|
-
By default this shows only fields that have a help text. If you
|
367
|
-
specify `all=True`, then also fields that have no help text will
|
368
|
-
be shown.
|
369
|
-
"""
|
370
|
-
if all is None:
|
371
|
-
all = fieldnames is not None
|
372
|
-
|
373
|
-
cells = []
|
374
|
-
# cols = ["Internal name", "Verbose name", "Help text"]
|
375
|
-
for fld in get_fields(model, fieldnames, columns):
|
376
|
-
if fld is not None and hasattr(fld, "verbose_name"):
|
377
|
-
ht = fld.help_text or ""
|
378
|
-
if ht or all:
|
379
|
-
cells.append([fld.name, fld.verbose_name, unindent(ht)])
|
380
|
-
|
381
|
-
# return table(cols, cells).strip()
|
382
|
-
items = ["{} ({}) : {}".format(row[1], row[0], row[2]) for row in cells]
|
383
|
-
return rstgen.ul(items).strip()
|
384
|
-
|
385
|
-
|
386
321
|
def show_fields(*args, **kwargs):
|
387
322
|
print(fields_help(*args, **kwargs))
|
388
323
|
|
lino/api/rt.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Copyright 2014-2018 Rumma & Ko Ltd
|
2
2
|
# License: GNU Affero General Public License v3 (see file COPYING for details)
|
3
3
|
|
4
|
+
from lino.core.utils import login, show, shows
|
5
|
+
from lino.core.exceptions import ChangedAPI
|
4
6
|
from django.conf import settings
|
5
7
|
|
6
8
|
from lino.core.utils import models_by_base
|
@@ -9,7 +11,6 @@ models = settings.SITE.models
|
|
9
11
|
"""
|
10
12
|
"""
|
11
13
|
|
12
|
-
from lino.core.exceptions import ChangedAPI
|
13
14
|
# actors = modules = ChangedAPI(
|
14
15
|
# "Replace rt.modules and rt.actors by rt.models")
|
15
16
|
|
@@ -32,9 +33,6 @@ def get_template(*args, **kw):
|
|
32
33
|
return settings.SITE.plugins.jinja.renderer.jinja_env.get_template(*args, **kw)
|
33
34
|
|
34
35
|
|
35
|
-
from lino.core.utils import login, show, shows
|
36
|
-
|
37
|
-
|
38
36
|
# def send_email(*args, **kw):
|
39
37
|
# "Shortcut to :meth:`lino.core.site.Site.send_email`."
|
40
38
|
# return settings.SITE.send_email(*args, **kw)
|
lino/core/actors.py
CHANGED
@@ -8,11 +8,8 @@ See :doc:`/dev/actors`.
|
|
8
8
|
|
9
9
|
"""
|
10
10
|
|
11
|
-
from lino import logger
|
12
|
-
|
13
11
|
import copy
|
14
|
-
import
|
15
|
-
import html
|
12
|
+
import warnings
|
16
13
|
from types import GeneratorType
|
17
14
|
from inspect import getmro
|
18
15
|
|
@@ -22,6 +19,7 @@ from django.utils.translation import gettext_lazy as _
|
|
22
19
|
from django.utils.html import format_html, mark_safe, SafeString
|
23
20
|
from django.core.exceptions import BadRequest
|
24
21
|
|
22
|
+
from lino import logger
|
25
23
|
from lino.utils import isiterable
|
26
24
|
from lino.utils import MissingRow
|
27
25
|
from lino.core import fields
|
@@ -38,8 +36,7 @@ from lino.core.utils import qs2summary
|
|
38
36
|
from lino.core.utils import ParameterPanel
|
39
37
|
from lino.core.utils import navinfo, dbfield2params_field
|
40
38
|
from lino.utils import curry, AttrDict, is_string
|
41
|
-
|
42
|
-
from lino.utils.html import E, forcetext, tostring, Grouper, SAFE_EMPTY
|
39
|
+
from lino.utils.html import E, tostring, Grouper, SAFE_EMPTY
|
43
40
|
# from lino.utils.html import assert_safe
|
44
41
|
|
45
42
|
from .roles import SiteUser
|
@@ -656,7 +653,6 @@ class Actor(actions.Parametrizable, Permittable, metaclass=ActorMetaClass):
|
|
656
653
|
try:
|
657
654
|
settings.SITE.kernel.setup_handle(h, ar)
|
658
655
|
except Exception as e:
|
659
|
-
# traceback.print_exc()
|
660
656
|
logger.warning(
|
661
657
|
"%s setup_handle failed with %s (change actors.py to see more)",
|
662
658
|
self,
|
@@ -1841,7 +1837,17 @@ class Actor(actions.Parametrizable, Permittable, metaclass=ActorMetaClass):
|
|
1841
1837
|
return kw
|
1842
1838
|
|
1843
1839
|
@classmethod
|
1844
|
-
def request(cls,
|
1840
|
+
def request(cls, *args, **kwargs):
|
1841
|
+
"""
|
1842
|
+
Old name for :meth:`create_request`. Still does the same but with a
|
1843
|
+
deprecation warning.
|
1844
|
+
"""
|
1845
|
+
warnings.warn(
|
1846
|
+
"Please call create_request() instead of request()", DeprecationWarning)
|
1847
|
+
return cls.create_request(*args, **kwargs)
|
1848
|
+
|
1849
|
+
@classmethod
|
1850
|
+
def create_request(cls, master_instance=None, **kwargs):
|
1845
1851
|
"""Return a new :class:`ActionRequest
|
1846
1852
|
<lino.core.requests.ActionRequest>` on this actor.
|
1847
1853
|
|
@@ -1867,7 +1873,7 @@ class Actor(actions.Parametrizable, Permittable, metaclass=ActorMetaClass):
|
|
1867
1873
|
|
1868
1874
|
@classmethod
|
1869
1875
|
def to_html(self, **kw):
|
1870
|
-
return tostring(self.
|
1876
|
+
return tostring(self.create_request(**kw).table2xhtml())
|
1871
1877
|
|
1872
1878
|
@classmethod
|
1873
1879
|
def get_screenshot_requests(self, language):
|
@@ -1896,7 +1902,7 @@ class Actor(actions.Parametrizable, Permittable, metaclass=ActorMetaClass):
|
|
1896
1902
|
kwargs.update(parent=ar)
|
1897
1903
|
kwargs.update(renderer=settings.SITE.kernel.default_renderer)
|
1898
1904
|
try:
|
1899
|
-
ar = cls.
|
1905
|
+
ar = cls.create_request(master_instance=master, **kwargs)
|
1900
1906
|
el = cls.table_as_html(ar)
|
1901
1907
|
except Exception as e:
|
1902
1908
|
msg = f"20241004 Error in {repr(ar)}: {e}"
|
@@ -1911,8 +1917,8 @@ class Actor(actions.Parametrizable, Permittable, metaclass=ActorMetaClass):
|
|
1911
1917
|
@classmethod
|
1912
1918
|
def get_table_as_list(cls, obj, ar):
|
1913
1919
|
# raise Exception("20240316")
|
1914
|
-
sar = cls.
|
1915
|
-
|
1920
|
+
sar = cls.create_request(parent=ar, master_instance=obj,
|
1921
|
+
is_on_main_actor=False)
|
1916
1922
|
grp = Grouper(sar)
|
1917
1923
|
html_text = grp.begin()
|
1918
1924
|
for i, obj in enumerate(sar.data_iterator):
|
@@ -1946,8 +1952,8 @@ class Actor(actions.Parametrizable, Permittable, metaclass=ActorMetaClass):
|
|
1946
1952
|
|
1947
1953
|
@classmethod
|
1948
1954
|
def get_table_story(cls, obj, ar):
|
1949
|
-
sar = cls.
|
1950
|
-
|
1955
|
+
sar = cls.create_request(parent=ar, master_instance=obj,
|
1956
|
+
is_on_main_actor=False)
|
1951
1957
|
html = SAFE_EMPTY
|
1952
1958
|
for i, obj in enumerate(sar.data_iterator):
|
1953
1959
|
if i == cls.preview_limit:
|
@@ -1973,8 +1979,8 @@ class Actor(actions.Parametrizable, Permittable, metaclass=ActorMetaClass):
|
|
1973
1979
|
"""
|
1974
1980
|
if ar is None:
|
1975
1981
|
return ''
|
1976
|
-
sar = cls.
|
1977
|
-
|
1982
|
+
sar = cls.create_request(parent=ar, master_instance=obj,
|
1983
|
+
is_on_main_actor=False)
|
1978
1984
|
return cls.get_table_summary(sar)
|
1979
1985
|
|
1980
1986
|
@classmethod
|
lino/core/boundaction.py
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
# -*- coding: UTF-8 -*-
|
2
|
-
# Copyright 2009-
|
2
|
+
# Copyright 2009-2025 Rumma & Ko Ltd
|
3
3
|
# License: GNU Affero General Public License v3 (see file COPYING for details)
|
4
4
|
"""
|
5
5
|
.. autosummary::
|
6
6
|
|
7
7
|
"""
|
8
8
|
|
9
|
-
from lino import logger
|
10
9
|
import os
|
10
|
+
import warnings
|
11
11
|
|
12
12
|
from django.conf import settings
|
13
13
|
|
14
|
+
from lino import logger
|
14
15
|
from lino.utils import curry
|
15
16
|
# from .actions import Action
|
16
17
|
|
@@ -21,7 +22,7 @@ from lino.core.permissions import (
|
|
21
22
|
|
22
23
|
|
23
24
|
class BoundAction(object):
|
24
|
-
"""An
|
25
|
+
"""An action that is bound to an actor. If an actor has subclasses,
|
25
26
|
each subclass "inherits" its actions.
|
26
27
|
|
27
28
|
"""
|
@@ -94,15 +95,24 @@ class BoundAction(object):
|
|
94
95
|
def full_name(self):
|
95
96
|
return self.action.full_name(self.actor)
|
96
97
|
|
97
|
-
def
|
98
|
-
# print("20170116 BoundAction.
|
98
|
+
def create_request(self, *args, **kw):
|
99
|
+
# print("20170116 BoundAction.create_request()", args, kw)
|
99
100
|
kw.update(action=self)
|
100
|
-
return self.actor.
|
101
|
+
return self.actor.create_request(*args, **kw)
|
102
|
+
|
103
|
+
def request(self, *args, **kwargs):
|
104
|
+
"""
|
105
|
+
Old name for :meth:`create_request`. Still does the same but with a
|
106
|
+
deprecation warning.
|
107
|
+
"""
|
108
|
+
warnings.warn(
|
109
|
+
"Please call create_request() instead of request()", DeprecationWarning)
|
110
|
+
return self.create_request(*args, **kwargs)
|
101
111
|
|
102
112
|
def request_from(self, ar, *args, **kw):
|
103
113
|
"""Create a request of this action from parent request `ar`."""
|
104
114
|
kw.update(parent=ar)
|
105
|
-
return self.
|
115
|
+
return self.create_request(*args, **kw)
|
106
116
|
|
107
117
|
def run_from_session(self, ses, **kw):
|
108
118
|
ar = self.request_from(ses, **kw)
|
lino/core/dashboard.py
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
|
6
6
|
"""
|
7
7
|
|
8
|
-
from django.conf import settings
|
9
|
-
from lino.api import _
|
8
|
+
# from django.conf import settings
|
9
|
+
# from lino.api import _
|
10
10
|
from lino.core.permissions import Permittable
|
11
11
|
from lino.core.requests import ActionRequest
|
12
12
|
from lino.core.tables import AbstractTable
|
@@ -78,7 +78,7 @@ class DashboardItem(Permittable):
|
|
78
78
|
# TODO 20220930 until now, dashboard was always acting as if
|
79
79
|
# display_mode was DISPLAY_MODE_GRID
|
80
80
|
if issubclass(sar.actor, AbstractTable):
|
81
|
-
|
81
|
+
# if isinstance(sar.bound_action.action, ShowTable):
|
82
82
|
for e in sar.renderer.table2story(sar, **kwargs):
|
83
83
|
# assert_safe(tostring(e))
|
84
84
|
yield tostring(e)
|
@@ -149,7 +149,8 @@ class ActorItem(DashboardItem):
|
|
149
149
|
# from lino.core.tables import AbstractTable
|
150
150
|
T = self.actor
|
151
151
|
# if isinstance(T, AbstractTable):
|
152
|
-
|
152
|
+
# , renderer=settings.SITE.kernel.default_renderer)
|
153
|
+
sar = T.create_request(limit=T.preview_limit, parent=ar)
|
153
154
|
# sar = ar.spawn(T, limit=T.preview_limit)
|
154
155
|
# sar = ar.spawn_request(actor=T, limit=T.preview_limit)
|
155
156
|
# raise Exception("20230331 {}".format(ar.subst_user))
|
lino/core/dbtables.py
CHANGED
@@ -4,6 +4,17 @@
|
|
4
4
|
This defines the :class:`Table` class.
|
5
5
|
"""
|
6
6
|
|
7
|
+
from lino.core.gfks import ContentType, GenericForeignKey
|
8
|
+
from lino.core.tables import AbstractTable
|
9
|
+
from lino.core.utils import resolve_model, get_field, UnresolvedModel
|
10
|
+
from .utils import models_by_base
|
11
|
+
from lino.core.choicelists import ChoiceListField
|
12
|
+
from lino.core import constants
|
13
|
+
from lino.core import actors
|
14
|
+
from lino.core.model import Model
|
15
|
+
from lino.core import actions
|
16
|
+
from lino.core import fields
|
17
|
+
from lino.utils.html import tostring, assert_safe
|
7
18
|
from lino import logger
|
8
19
|
|
9
20
|
import datetime
|
@@ -21,21 +32,9 @@ from django.apps import apps
|
|
21
32
|
|
22
33
|
get_models = apps.get_models
|
23
34
|
|
24
|
-
from lino.utils.html import tostring, assert_safe
|
25
35
|
|
26
|
-
from lino.core import fields
|
27
|
-
from lino.core import actions
|
28
|
-
from lino.core.model import Model
|
29
|
-
from lino.core import actors
|
30
|
-
from lino.core import constants
|
31
|
-
|
32
|
-
from lino.core.choicelists import ChoiceListField
|
33
|
-
from .utils import models_by_base
|
34
36
|
# from .fields import get_data_elem_from_model
|
35
37
|
|
36
|
-
from lino.core.utils import resolve_model, get_field, UnresolvedModel
|
37
|
-
from lino.core.tables import AbstractTable
|
38
|
-
from lino.core.gfks import ContentType, GenericForeignKey
|
39
38
|
|
40
39
|
INVALID_MK = "Invalid master_key '{0}' in {1} : {2}"
|
41
40
|
|
@@ -260,10 +259,10 @@ class Table(AbstractTable):
|
|
260
259
|
profiles2user[u.user_type] = u
|
261
260
|
for user in list(profiles2user.values()):
|
262
261
|
# if user.profile.name != 'admin': return
|
263
|
-
# yield self.default_action.
|
262
|
+
# yield self.default_action.create_request(user=user)
|
264
263
|
# and self.default_action is not self.detail_action:
|
265
264
|
if self.detail_action:
|
266
|
-
yield self.detail_action.
|
265
|
+
yield self.detail_action.create_request(user=user)
|
267
266
|
|
268
267
|
# @classmethod
|
269
268
|
# def elem_get_printable_target_stem(cls,elem):
|
@@ -589,7 +588,7 @@ class Table(AbstractTable):
|
|
589
588
|
if self.delete_action is None:
|
590
589
|
return "No delete_action"
|
591
590
|
if not self.get_row_permission(
|
592
|
-
|
591
|
+
obj, ar, self.get_row_state(obj), self.delete_action):
|
593
592
|
# print "20130222 ar is %r" % ar
|
594
593
|
# logger.info("20130225 dbtables.disable_delete no permission")
|
595
594
|
return _("You have no permission to delete this row.")
|
@@ -601,7 +600,7 @@ class Table(AbstractTable):
|
|
601
600
|
|
602
601
|
# raise Exception("20240321 get_request_queryset", self)
|
603
602
|
# if not isinstance(ar, TableRequest):
|
604
|
-
# ar = self.
|
603
|
+
# ar = self.create_request(parent=ar)
|
605
604
|
|
606
605
|
def apply(qs):
|
607
606
|
# print("20160329 {}".format(qs.query))
|
lino/core/fields.py
CHANGED
@@ -1663,7 +1663,7 @@ def make_remote_field(model, name):
|
|
1663
1663
|
# fld.related_model, rkw))
|
1664
1664
|
reltarget = fld.related_model(**rkw)
|
1665
1665
|
reltarget.save_new_instance(
|
1666
|
-
fld.related_model.get_default_table().
|
1666
|
+
fld.related_model.get_default_table().create_request()
|
1667
1667
|
)
|
1668
1668
|
|
1669
1669
|
setattr(target, fld.name, reltarget)
|
@@ -1774,8 +1774,8 @@ def choices_for_field(ar, holder, field):
|
|
1774
1774
|
if isinstance(field, models.ForeignKey):
|
1775
1775
|
m = field.remote_field.model
|
1776
1776
|
t = m.get_default_table()
|
1777
|
-
# qs = t.
|
1778
|
-
qs = t.
|
1777
|
+
# qs = t.create_request(request=ar.request).data_iterator
|
1778
|
+
qs = t.create_request(parent=ar).data_iterator
|
1779
1779
|
|
1780
1780
|
# logger.info('20120710 choices_view(FK) %s --> %s', t, qs.query)
|
1781
1781
|
|
lino/core/menus.py
CHANGED
@@ -160,7 +160,7 @@ class MenuItem(object):
|
|
160
160
|
# return False
|
161
161
|
|
162
162
|
def openui5Render(self):
|
163
|
-
ar = self.bound_action.
|
163
|
+
ar = self.bound_action.create_request(**self.params)
|
164
164
|
js = settings.SITE.kernel.default_renderer.request_handler(ar)
|
165
165
|
return js
|
166
166
|
|
lino/core/model.py
CHANGED
@@ -604,7 +604,7 @@ class Model(models.Model, fields.TableRow):
|
|
604
604
|
database query and show this value as the search result.
|
605
605
|
|
606
606
|
"""
|
607
|
-
ar = self.__class__.get_default_table().
|
607
|
+
ar = self.__class__.get_default_table().create_request()
|
608
608
|
return self.as_search_item(ar)
|
609
609
|
|
610
610
|
# def summary_row(self, ar, **kw):
|
lino/core/renderer.py
CHANGED
@@ -197,7 +197,7 @@ class HtmlRenderer(Renderer):
|
|
197
197
|
import rstgen
|
198
198
|
|
199
199
|
if display_mode == constants.DISPLAY_MODE_CARDS:
|
200
|
-
layout = ar.actor.card_layout
|
200
|
+
layout = ar.actor.card_layout # or ar.actor.list_layout
|
201
201
|
lh = layout.get_layout_handle()
|
202
202
|
else:
|
203
203
|
lh = ar.bound_action.get_layout_handel()
|
@@ -320,13 +320,12 @@ class HtmlRenderer(Renderer):
|
|
320
320
|
Return a string of Javascript code that would open a detail window
|
321
321
|
on the given database object.
|
322
322
|
"""
|
323
|
-
status.update(record_id=obj.pk)
|
324
|
-
|
325
323
|
if ba is None:
|
326
324
|
ba = obj.get_detail_action(ar)
|
327
325
|
# ba = obj.__class__.get_default_table().detail_action
|
328
|
-
# print(20180831, ba.get_view_permission(ar.get_user().user_type))
|
329
326
|
if ba is not None:
|
327
|
+
# print(f"20250319 instance_handler {ba} {status} {self.action_call}")
|
328
|
+
status.update(record_id=obj.pk)
|
330
329
|
return self.action_call(ar, ba, status)
|
331
330
|
|
332
331
|
def href_to(self, ar, obj, text=None):
|
@@ -641,7 +640,7 @@ class HtmlRenderer(Renderer):
|
|
641
640
|
# 20200501 elems.append(item)
|
642
641
|
elems.append(tostring(item))
|
643
642
|
elif isinstance(item, type) and issubclass(item, Actor):
|
644
|
-
ar = item.default_action.
|
643
|
+
ar = item.default_action.create_request(parent=ar)
|
645
644
|
# 20200501 elems.extend(self.table2story(ar, **kwargs))
|
646
645
|
elems += [tostring(e) for e in self.table2story(ar, **kwargs)]
|
647
646
|
elif isinstance(item, ActionRequest):
|
@@ -649,12 +648,12 @@ class HtmlRenderer(Renderer):
|
|
649
648
|
if issubclass(item.actor, AbstractTable):
|
650
649
|
# 20200501 elems.extend(self.table2story(item, **kwargs))
|
651
650
|
elems += [tostring(e)
|
652
|
-
|
651
|
+
for e in self.table2story(item, **kwargs)]
|
653
652
|
else:
|
654
653
|
# example : courses.StatusReport in dashboard
|
655
654
|
# 20200501 elems.append(self.show_story(ar, item.actor.get_story(None, ar), **kwargs))
|
656
655
|
elems += [tostring(e)
|
657
|
-
|
656
|
+
for e in self.show_story(
|
658
657
|
ar, item.actor.get_story(None, ar), **kwargs)]
|
659
658
|
elif isinstance(item, DashboardItem):
|
660
659
|
elems.extend(item.render(ar, **kwargs))
|
@@ -707,7 +706,7 @@ class HtmlRenderer(Renderer):
|
|
707
706
|
if not isinstance(mnu, Menu):
|
708
707
|
assert isinstance(mnu, MenuItem)
|
709
708
|
if mnu.bound_action:
|
710
|
-
sar = mnu.bound_action.actor.
|
709
|
+
sar = mnu.bound_action.actor.create_request(
|
711
710
|
action=mnu.bound_action,
|
712
711
|
user=ar.user,
|
713
712
|
subst_user=ar.subst_user,
|
@@ -812,7 +811,7 @@ class TextRenderer(HtmlRenderer):
|
|
812
811
|
header_links=None,
|
813
812
|
nosummary=False,
|
814
813
|
stripped=True,
|
815
|
-
show_links=False,
|
814
|
+
show_links=False, # added 20241031
|
816
815
|
display_mode=None,
|
817
816
|
**kwargs
|
818
817
|
):
|
@@ -938,7 +937,7 @@ class TextRenderer(HtmlRenderer):
|
|
938
937
|
if iselement(item):
|
939
938
|
print(to_rst(item, stripped))
|
940
939
|
elif isinstance(item, type) and issubclass(item, Actor):
|
941
|
-
ar = item.default_action.
|
940
|
+
ar = item.default_action.create_request(parent=ar)
|
942
941
|
self.show_table(ar, stripped=stripped, **kwargs)
|
943
942
|
elif isinstance(item, DashboardItem):
|
944
943
|
self.show_story(ar, item.get_story(ar), stripped, **kwargs)
|
@@ -1029,7 +1028,7 @@ class JsRenderer(HtmlRenderer):
|
|
1029
1028
|
"""Instruct the client to display a detail window on the given
|
1030
1029
|
record.
|
1031
1030
|
"""
|
1032
|
-
# print("
|
1031
|
+
# print("20250319 goto_instance", ar.get_user(), obj, detail_action, js)
|
1033
1032
|
js = self.instance_handler(ar, obj, detail_action)
|
1034
1033
|
kw.update(eval_js=js)
|
1035
1034
|
ar.set_response(**kw)
|
lino/core/requests.py
CHANGED
@@ -783,14 +783,14 @@ class BaseRequest:
|
|
783
783
|
spec.setup_from(self)
|
784
784
|
elif isinstance(spec, BoundAction):
|
785
785
|
kw.update(parent=self)
|
786
|
-
spec = spec.
|
786
|
+
spec = spec.create_request(**kw)
|
787
787
|
else:
|
788
788
|
kw.update(parent=self)
|
789
789
|
ba = resolve_action(spec)
|
790
|
-
spec = ba.
|
790
|
+
spec = ba.create_request(**kw)
|
791
791
|
# from lino.core.menus import create_item
|
792
792
|
# mi = create_item(spec)
|
793
|
-
# spec = mi.bound_action.
|
793
|
+
# spec = mi.bound_action.create_request(**kw)
|
794
794
|
return spec
|
795
795
|
|
796
796
|
def get_printable_context(self, **kw):
|
@@ -1011,10 +1011,14 @@ class BaseRequest:
|
|
1011
1011
|
# # deprecated?
|
1012
1012
|
# self.append_message('warning', msg, *args, **kw)
|
1013
1013
|
|
1014
|
-
debug
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1014
|
+
def debug(self, *args, **kwargs):
|
1015
|
+
return self.logger.debug(*args, **kwargs)
|
1016
|
+
|
1017
|
+
def info(self, *args, **kwargs):
|
1018
|
+
return self.logger.info(*args, **kwargs)
|
1019
|
+
|
1020
|
+
def warning(self, *args, **kwargs):
|
1021
|
+
return self.logger.warning(*args, **kwargs)
|
1018
1022
|
|
1019
1023
|
async def adebug(self, *args, **kwargs):
|
1020
1024
|
return await self.alogger.debug(*args, **kwargs)
|
lino/core/tables.py
CHANGED
@@ -637,9 +637,9 @@ method in order to sort the rows of the queryset.
|
|
637
637
|
ba = self.get_action_by_name(an)
|
638
638
|
# ~ print ba
|
639
639
|
if pk is None:
|
640
|
-
ar = self.
|
640
|
+
ar = self.create_request(action=ba)
|
641
641
|
else:
|
642
|
-
ar = self.
|
642
|
+
ar = self.create_request(action=ba, selected_pks=[pk])
|
643
643
|
|
644
644
|
ba.action.run_from_ui(ar)
|
645
645
|
kw = ar.response
|
lino/core/utils.py
CHANGED
@@ -17,7 +17,7 @@ from django.utils.html import format_html, mark_safe, SafeString
|
|
17
17
|
from django.db import models
|
18
18
|
from django.db.models import Q
|
19
19
|
from django.core.exceptions import FieldDoesNotExist
|
20
|
-
from django.utils.functional import lazy
|
20
|
+
# from django.utils.functional import lazy
|
21
21
|
from importlib import import_module
|
22
22
|
from django.utils.translation import gettext as _
|
23
23
|
from django.conf import settings
|
@@ -1046,7 +1046,7 @@ class InstanceAction:
|
|
1046
1046
|
"""
|
1047
1047
|
kwargs.update(selected_rows=[self.instance])
|
1048
1048
|
kwargs.update(parent=ses)
|
1049
|
-
ar = self.bound_action.
|
1049
|
+
ar = self.bound_action.create_request(**kwargs)
|
1050
1050
|
return ar
|
1051
1051
|
|
1052
1052
|
def run_from_session(self, ses, **kwargs):
|
@@ -1070,7 +1070,7 @@ class InstanceAction:
|
|
1070
1070
|
"""
|
1071
1071
|
if len(args) and isinstance(args[0], BaseRequest):
|
1072
1072
|
raise ChangedAPI("20181004")
|
1073
|
-
ar = self.bound_action.
|
1073
|
+
ar = self.bound_action.create_request(
|
1074
1074
|
renderer=settings.SITE.kernel.text_renderer)
|
1075
1075
|
self.run_from_code(ar, *args, **kwargs)
|
1076
1076
|
return ar.response
|
lino/core/views.py
CHANGED
@@ -100,7 +100,7 @@ def action_request(app_label, actor, request, rqdata, is_list, **kw):
|
|
100
100
|
# internationalized because some error handling code
|
101
101
|
# may want to write it to a plain ascii stream.
|
102
102
|
kw.update(renderer=settings.SITE.kernel.default_renderer)
|
103
|
-
ar = rpt.
|
103
|
+
ar = rpt.create_request(request=request, action=a, rqdata=rqdata, **kw)
|
104
104
|
# print("20210403b", a.action.__class__, rqdata)
|
105
105
|
return ar
|
106
106
|
|
@@ -137,7 +137,7 @@ def choices_response(actor, request, qs, row2dict, emptyValue, field=None):
|
|
137
137
|
count = qs.count()
|
138
138
|
|
139
139
|
if offset:
|
140
|
-
qs = qs[int(offset)
|
140
|
+
qs = qs[int(offset):]
|
141
141
|
# ~ kw.update(offset=int(offset))
|
142
142
|
|
143
143
|
if limit:
|
@@ -155,7 +155,7 @@ def choices_response(actor, request, qs, row2dict, emptyValue, field=None):
|
|
155
155
|
row for row in rows if txt in row[constants.CHOICES_TEXT_FIELD].lower()
|
156
156
|
]
|
157
157
|
count = len(rows)
|
158
|
-
rows = rows[int(offset)
|
158
|
+
rows = rows[int(offset):] if offset else rows
|
159
159
|
rows = rows[: int(limit)] if limit else rows
|
160
160
|
|
161
161
|
if wt == constants.WINDOW_TYPE_PARAMS and field and field.blank:
|