title: Randomly adding messages to the Django messages framework
body: <p>In a Django project I have a space in the templates to show the messages coming from the Django messages framework. I would like to use that framework to show some messages that are not triggered by user actions in some views but instead are set by an app. Ideally my app will decide when it is best to send the messages but initially it will be random. An example to clarify a bit; I don't want to send the typical message related to an action like 'you have successfully updated your profile'. Instead I would like to recommend some content from times to times, something like 'you might be interested by spam'. The content ('spam' in this case) is provided by some objects in the database that another app gathers already. </p>
  
  <p>I was wondering how I can set a message outside of the typical view. I was thinking about implementing a middleware that would be called on every request and setting the message in the process-request() class if this particular user has been marked to receive any.</p>
  
  <p>Is it the even a good idea to begin with?</p>