0

Every time a certain table is saved/created in my application I want a text file on the server to be updated in tandem. I've been thinking that this could be either done each time the model's save() method is called, or perhaps just achieved as a regular job every hour, for example.

I can't see a standard Django-y way of actually implementing this, does anyone have a suggestion, or perhaps a better idea?

Thanks very much

R.B.
  • 255
  • 1
  • 4
  • 11
  • I would recommend reading http://stackoverflow.com/questions/573618/django-set-up-a-scheduled-job – Mark Lavin Jan 03 '12 at 18:20
  • 1
    by table saved do you mean insert/update record record? have you looked into django's provided [logging](https://docs.djangoproject.com/en/dev/topics/logging/) functionality, have you considered your databases logging functionality? – T I Jan 03 '12 at 18:22

2 Answers2

1

Maybe you can use the Django signals to write the model changes in your file.

Reto Aebersold
  • 16,306
  • 5
  • 55
  • 74
0

If you're looking for revision support for your models you could always use django-reversion

https://github.com/etianen/django-reversion

This will keep track of all model changes.

If you want it to run every hour instead of on change, I recommend using django-celery to set up a task

https://github.com/ask/django-celery

dustinmm80
  • 942
  • 7
  • 7