Skip to content

[Feature] Add column_type_formatters_detail#999

Merged
mmzeynalli merged 12 commits into
smithyhq:mainfrom
maxim-f1:column-type-formatters-detail
Jul 13, 2026
Merged

[Feature] Add column_type_formatters_detail#999
mmzeynalli merged 12 commits into
smithyhq:mainfrom
maxim-f1:column-type-formatters-detail

Conversation

@maxim-f1

@maxim-f1 maxim-f1 commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

A new column_type_formatters_detail field has been added to ModelView.

  1. This field follows the same principle as column_type_formatters, with the sole difference that it is only applied on the details page.

  2. If column_type_formatters_detail is not set, the details page will fall back to using formatting from column_type_formatters.

  3. Several additional built-in formatters have been introduced (the default column_type_formatters remains unchanged).

  4. Now, when a parent class is used as the key for column_type_formatters or column_type_formatters_detail, all its child classes will also be formatted accordingly.

  5. If both a child and its parent are specified, the child's formatter takes precedence.

New formatters

1. StrEnum Formatter

Adds a tooltip displaying the list of available enum values.

List:

str_enum_title_list

Details:

str_enum_title_details

2. Copy String Formatter

Adds a copy-to-clipboard button for any string field content.

List:

copy_list

Details:

copy_details_1 copy_details_2

3. date or datetime Formatter

Adds a tooltip with the precise timestamp and displays the date in a human-readable format.

List:

datetime_list

Details:

datetime_details

maxim-f1 added 8 commits December 21, 2025 12:33
@mmzeynalli

mmzeynalli commented Apr 4, 2026

Copy link
Copy Markdown
Member

@maxim-f1 any updates on this one? Shall we keep it open?

@maxim-f1

maxim-f1 commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

@mmzeynalli

Will doing everything as I want be harmful because Python <3.11 doesn't support StrEnum. My options are:

  1. I can remove all uses of StrEnum, but then I'll have to remove the str_enum_formatter formatting template.

  2. I'll try to support this functionality in older versions.

I'm leaning toward the first option.

@mmzeynalli

Copy link
Copy Markdown
Member

This is nice feature, if possible finalize this. I think you can keep StrEnum with the hack you used in formatters.py.

@mmzeynalli mmzeynalli added the needs-update There are stuff that needs updated and reviewed again label May 20, 2026
@mmzeynalli mmzeynalli marked this pull request as ready for review July 8, 2026 14:23
Comment thread sqladmin/models.py Outdated
Comment on lines +69 to +78
# Import StrEnum for python < 3.10 and > 3.11
if sys.version_info < (3, 11):

class StrEnum(str, Enum):
__str__ = str.__str__
__repr__ = Enum.__repr__
else:
from enum import StrEnum as StrEnum # noqa: F401


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import StrEnum from formatters

@mmzeynalli mmzeynalli added ready-to-merge Approved and ready to merge. Will be published with the next release. and removed needs-update There are stuff that needs updated and reviewed again labels Jul 8, 2026
@mmzeynalli mmzeynalli merged commit 1fa098d into smithyhq:main Jul 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Approved and ready to merge. Will be published with the next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants