Hi Michael,
The best bet would be to write a custom widget, and override the render() method. render() takes the name of the widget, the value to render, and a dictionary of attr values. In your subclass, you can override this method to inject the additional attributes based on the provided value - something like:
class MyWidget(TextInput):
def render(self, name, value, attrs=None):
if value == SPECIAL VALUE:
attrs['class'] = 'class1 class2'
return super(MyWidget, self).render(name, value, attrs)
This is an oversimplification - there's a few extra edge cases you'll need to account for - if attrs is none, or if 'class' already exists - but the idea should hopefully make sense.
Yours,
Russ Magee %-)