How to check if django template variable is defined?
问题 I have a django template which is used from many views. The template has a block for messages used to notify user of anything that should take their attention. Whether a message is sent or not depends on the views. Some views may send a message variable to the template while others may not. view_1: message = "This is an important message" render_to_response("my_template.html", {'message':message, 'foo':foo, 'bar':bar}, context_instance = RequestContext(request)) view_2: message = "This is an