Skip to content

Conversation

@geoolekom
Copy link

@geoolekom geoolekom commented Feb 12, 2024

Now, if a SQLA Column has a default value, it is used in the admin panel. If it is a scalar, then the value is used directly. If it is a function or SQL expression, the extra help text is displayed.

image

@hasansezertasan
Copy link
Contributor

Related to #491

@geoolekom
Copy link
Author

Sorry, @hasansezertasan, any updates on this PR?

@hasansezertasan
Copy link
Contributor

Sorry, @hasansezertasan, any updates on this PR?

It's OK. I was the one who volunteered but I couldn't get my hands free for this. I'll work on it when I get a chance.

id: str = ""
search_builder_type: Optional[str] = "default"
required: Optional[bool] = False
default: str = ""
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
default: str = ""
default: Optional[Any] = None

@jowilf
Copy link
Owner

jowilf commented Mar 6, 2024

Thank you, @geoolekom, for submitting this pull request. Would you be interested in implementing it for other backends as well?

@geoolekom geoolekom force-pushed the feature/use-sqla-defaults branch from f17d460 to 0c1ad9d Compare April 18, 2024 09:07
@geoolekom
Copy link
Author

geoolekom commented Apr 18, 2024

Thank you, @geoolekom, for submitting this pull request. Would you be interested in implementing it for other backends as well?

Unfortunately, for now I don't have much time to implement other backends in this PR. Perhaps later, in a separate pull request.

For now, I fixed failed CI checks for SQLA backend. Could you trigger the pipeline again?

@geoolekom geoolekom requested a review from jowilf April 18, 2024 09:20
@geoolekom geoolekom force-pushed the feature/use-sqla-defaults branch from ca3699e to a0da93d Compare April 29, 2024 08:57
@alidiusk
Copy link

Hi, I'm wondering if there's any work remaining on this that I could assist with. It would be nice to have for a project I'm working on.

@jowilf jowilf added this to the Release 0.15.0 milestone Feb 1, 2025
Copy link
Owner

@jowilf jowilf left a comment

Choose a reason for hiding this comment

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

sorry @geoolekom for taking to long to review. it looks good, we just need to solve conflicts with the base branch

@jowilf jowilf removed this from the Release 0.15.0 milestone Apr 25, 2025
@KozyrevIvan
Copy link

KozyrevIvan commented Jul 28, 2025

Still missing default in CollectionField and ListField

I think it can be done like this

@dataclass(init=False)
class CollectionField(BaseField):
   ....
    def __init__(
        self, name: str, fields: Sequence[BaseField], required: bool = False
    ) -> None:
        self.name = name
        self.fields = fields
        self.required = required
        self.default = {field.name: field.default for field in fields} # Set default values
        super().__post_init__()
        self._propagate_id()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants