python - Popup window not displaying Django messages -


i have django website displays different gantt charts based on user selections. have bunch of django's logging messages in code , want able set , display in popup window once user hits submit button, can't seem messages display in popup.

my views.py looks this:

from django.contrib import messages  def gantt_search(request):    if request.method == 'post':     messages.info(request,"query submitted, beginning query results render for:")      form_start = window_start_form(request.post,section_label="window_start")      if form_start.is_valid():         ws_raw = form_start.cleaned_data['window_start']         messages.info(request,"window start time: {ws}".format(ws=ws_raw))      else:         messages.error(request,"the start date entered incorrectly formatted.")    else:     messages.info(request,"rendering query page")     form_start = window_start_form(section_label="window_start")    return render(request, 'interfaceapp/table_search.html', {'window_start': form_start})  def msgs(request):    m = messages.get_messages(request)    return render_to_response('interfaceapp/messages.html',{'message':m}) 

the results template contains code have display popup link , looks this:

<html>   <head>     <title>search results</title>     <meta charset="utf-8">     <script src="http://code.jquery.com/jquery-latest.min.js"></script>     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>     <script language="javascript" type="text/javascript">       function popitup(url) {           newwindow=window.open(url,'{{title}}','height=200,width=150');           if (window.focus) {newwindow.focus()}           return false;       }     </script>   </head>   <body>     <div class="container">       <a href="messages.html" onclick="return popitup('/interfaceapp/msgs')" > {% trans 'view log messages' %}       </a>     </div>   </body> </html> 

the messages.html template looks this:

<body>  <div class="container">   <h2>messages</h2>   {{ message }}  </div>  <div class="containter">   {% if messages %}   <ul class="messages">       {% message in messages %}       <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>           {% if message.level == default_message_levels.debug %}important: {% endif %}           {{ message }}       </li>       {% endfor %}   </ul>   {% endif %}  </div> </body> 

the popup window works alright, when opens see <django.contrib.messages.storage.fallback.fallbackstorage object @ 0x10965bdd0> instead of list of messages. messages display correctly @ top of results page when it's rendered don't want them there.

can tell me how fix this?

thanks!


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -