[EMAIL PROTECTED] wrote:
> Hi,
> 
> I am writing a web based chat client in Django framework. When ever I
> receive a message, I get that in a python function which is in the
> same file as my views. Can I directly pass this data to the template
> (by using response_to_render ) to update the template? Could someone
> suggest a way to automatically update messages in the site from python
> code.

are you talking about this? 
http://www.djangoproject.com/documentation/authentication/#messages

or something else?

If the function takes no parameters and returns a string, you can pass 
it in the context and call it like a variable.

{{ myfunction }}

I believe this will call the function each time it is used.  I'd 
probably do something like this instead.

def my_view(request):
   extra = dict()
   extra["message"] = myfunction(args, and, stuff)
   return render_to_response("mytemplate", extra)

see http://www.djangoproject.com/documentation/shortcuts/#render-to-response



-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___________________________________________________________________________
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to