I have a small problem that I am hoping you guys can help me with. I have two buttons that I use to approve, or disable rates. Basically, makes the boolean flag True or False. Now I’m having some trouble wrapping my head around this idea but, I would like to have only the Approve button show if rates are disabled, and vice versa for the Disable button.
Anyone have any suggestions to get me started?
Thanks so much.
Steve
You have two choices – hide & show the buttons server side with django or do it client side with javascript (as the other answers mention).
Either way, you first add the approved boolean to the Rate model – I’m guessing you know how to do that.
In a django template, you can use an if statement to check the approved boolean and show the results:
You should look at ajax though, because otherwise you’ll be doing an entire page load every time you click one of those buttons
http://www.nomadjourney.com/2009/01/using-django-templates-with-jquery-ajax/
http://www.b-list.org/weblog/2006/jul/31/django-tips-simple-ajax-example-part-1/ (old)