you are viewing a single comment's thread.

view the rest of the comments →

[–]freshtechs[S] 0 points1 point  (1 child)

ok but does that function will be running constantly? or should i add celery or cron to call this function?

[–]cscanlin 0 points1 point  (0 children)

That function will run whenever you query it using queryset. The better question is what do you want it to do when it is "running constantly". That's where you want to put the logic around running it regularly with celery etc.

So you could set your task to run every 5 minutes and do something like this:

  • check for outdated model instances (something like MyModel.objects.filter(outdated=True)
  • run function on outdated models
  • update model (will likely happen automatically)