Skip to content

Commit

Permalink
Update db function __init__'s to pass output_field (#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored Aug 31, 2022
1 parent c02617d commit a338d32
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/django_mysql/models/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class SingleArgFunc(Func):
output_field_class: type[DjangoField]

def __init__(self, expression: ExpressionArgument) -> None:
super().__init__(expression)
self.output_field = self.output_field_class()
super().__init__(expression, output_field=self.output_field_class())


# Control Flow Functions
Expand Down Expand Up @@ -223,11 +222,9 @@ class LastInsertId(Func):

def __init__(self, expression: ExpressionArgument | None = None) -> None:
if expression is not None:
super().__init__(expression)
super().__init__(expression, output_field=IntegerField())
else:
super().__init__()

self.output_field = IntegerField()
super().__init__(output_field=IntegerField())

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

0 comments on commit a338d32

Please sign in to comment.