Skip to content

Commit a338d32

Browse files
authored
Update db function __init__'s to pass output_field (#943)
1 parent c02617d commit a338d32

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/django_mysql/models/functions.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ class SingleArgFunc(Func):
2323
output_field_class: type[DjangoField]
2424

2525
def __init__(self, expression: ExpressionArgument) -> None:
26-
super().__init__(expression)
27-
self.output_field = self.output_field_class()
26+
super().__init__(expression, output_field=self.output_field_class())
2827

2928

3029
# Control Flow Functions
@@ -223,11 +222,9 @@ class LastInsertId(Func):
223222

224223
def __init__(self, expression: ExpressionArgument | None = None) -> None:
225224
if expression is not None:
226-
super().__init__(expression)
225+
super().__init__(expression, output_field=IntegerField())
227226
else:
228-
super().__init__()
229-
230-
self.output_field = IntegerField()
227+
super().__init__(output_field=IntegerField())
231228

232229
@classmethod
233230
def get(cls, using: str = DEFAULT_DB_ALIAS) -> int:

0 commit comments

Comments
 (0)