Hey Djangonauts,

So one of the (very few) things I had not been happy with regarding
Django is its flash message handling. So I wrote something that would
make me happy. Its just a template tag add-on. Since so far Django has
been so great to me, I wanted to give a little bit back. So I don't
know where to post this but I thought I'd post a message letting you
all know about it.

http://dpaste.com/hold/14510/

Usage is pretty simple..
In your view ..
>>>request.session['flash_msg'] = 'Your changes have been save'
>>>request.session['flash_params'] = {'type': 'success'}

And maybe put something like this in your view
{% flash %}
  <h2>{{ params.type }}</h2>
  {{ msg }}
{% endflash %}

It also support a flash template, you can specify a file
FLASH_TEMPLATE in your settings file and then that file will be
rendered with msg and params as available variable.
Usage for this would simply be {% flash_template %} and then you gotta
make a template file that does whatever you like.

Outside of that just be aware you need the Django session middleware
and request context installed in your app to use this.

Hope this helps somebody.

-Rob Conner


--~--~---------~--~----~------------~-------~--~----~
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