Can Django models use MySQL functions?

前端 未结 6 1643
情深已故
情深已故 2021-02-06 16:05

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to

6条回答
  •  孤街浪徒
    2021-02-06 16:52

    Using Django signals you can do stuff when a model instance is saved, but as far as I know you can't trigger anything on read.

    EDIT: My bad, it seems you can do stuff when initializing a model instance.

提交回复
热议问题