[Answer]-Issues with models functions in django

1👍

sure you can:

from my_app import models

output = models.my_function('foo', 'bar')

but.. don’t you feel it’s wrong? Semantically, models.py is for models. If you want an utility function, you can set up utils.py in your project and import from there. Otherwise, if this function is closely tied with a particular model, you can make it an object method instead, etc

👤Marat

Leave a comment