You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will then need to add shortcuts for these in your subclasses of `Column`, `Field`, and `Filter`. These can start out empty, and configuration can be done in the style definition:
82
-
83
-
"""
45
+
# @test
46
+
try:
47
+
# @end
48
+
49
+
# language=rst
50
+
"""
51
+
The issue with that is that the semantic meaning of each field is hidden behind the name, and not in the type. The `name`
52
+
and `person_number` fields have the same type but should be handled differently. Since iommi shortcut registrations are
53
+
based on the type, you can't customize the parsing or rendering of the `person_number` or `birth_place` fields on
54
+
the project level via the :ref:`style`.
55
+
56
+
Moreover in this example the type information alone is not enough for other customization. For `ForeignKey`, by default
57
+
in iommi you'll get a select2 drop-down to select from all items in that table. This is not good UX for a location, and
58
+
it's probably not good UX for a manager field either as that should most likely exclude non-active users, and/or limited
59
+
to users with a certain role.
60
+
61
+
For `CharField`, the default is to present a text field, but in the above model we want a Swedish "person number", which
62
+
has a specific storage format, can accept a variety of input formats that can be unambiguously parsed, and even has a
63
+
checksum that can be used to validate that the user input is correct.
64
+
65
+
A solution to this is to create an additional specialized type to specify semantic model fields:
You can also add configuration via the `Style` machinery. This is useful for reusable apps.
143
+
144
+
Semantic models requires a little bit more initial setup, but for commonly used field types, it will make new views correct by default and super easy to setup.
0 commit comments