One of the functionalities in a Django project I am writing is sending a newsletter. I have a model, Newsletter
and a function, send_newsletter
, which I have registered to listen to Newsletter
's post_save
signal. When the newsletter object is saved via the admin interface, send_newsletter
checks if created
is True, and if yes it actually sends the mail.
However, it doesn't make much sense to edit a newsletter that has already been sent, for the obvious reasons. Is there a way of making the Newsletter
object read-only once it has been saved?
Edit:
I know I can override the save
method of the object to raise an error or do nothin if the object existed. However, I don't see the point of doing that. As for the former, I don't know where to catch that error and how to communicate the user the fact that the object wasn't saved. As for the latter, giving the user false feedback (the admin interface saying that the save succeded) doesn't seem like a Good Thing.
What I really want is allow the user to use the Admin interface to write the newsletter and send it, and then browse the newsletters that have already been sent. I would like the admin interface to show the data for sent newsletters in an non-editable input box, without the "Save" button. Alternatively I would like the "Save" button to be inactive.