Skip to content

Commit

Permalink
Add server_default validation for nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsil committed Nov 24, 2023
1 parent bb9325d commit f4c0d76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions edgy/core/db/fields/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
) -> None:
self.max_digits: str = kwargs.pop("max_digits", None)
self.decimal_places: str = kwargs.pop("decimal_places", None)
self.server_default: Any = kwargs.pop("server_default", None)

super().__init__(**kwargs)

Expand All @@ -37,7 +38,7 @@ def __init__(
default = None
if default is not Undefined:
self.default = default
if default is not None:
if default is not None or self.server_default is not None:
self.null = True

self.defaulf_factory: Optional[Callable[..., Any]] = kwargs.pop(
Expand Down Expand Up @@ -75,7 +76,6 @@ def __init__(
"multiple_of", None
)
self.through: Any = kwargs.pop("through", None)
self.server_default: Any = kwargs.pop("server_default", None)
self.server_onupdate: Any = kwargs.pop("server_onupdate", None)
self.registry: Registry = kwargs.pop("registry", None)
self.comment = kwargs.pop("comment", None)
Expand Down

0 comments on commit f4c0d76

Please sign in to comment.