[stringtemplate-interest] ST, Django and get_something_display()
Terence Parr
parrt at cs.usfca.edu
Thu Jul 31 15:27:39 PDT 2008
On Jul 31, 2008, at 6:49 AM, Roman Odaisky wrote:
> Greetings,
>
> In Django, if I define a field “foo” and set its “choices”
> attribute, the
> framework automatically adds a get_foo_display() method to the model
> class.
> How do I refer to it in ST? $obj.foo_display$ looks for
> obj.getFoo_display()
> and fails, $obj.get_foo_display$ finds the method but stringizes the
> method
> instead of calling it (I get something like “<bound method
> obj._curried of
> <obj: some object>>”).
Hi Roman, i assumed people would follow the javabeans notation of
getFooDisplay. Too bad django doesn't. hmm...well, I'd say create a
wrapper object that converts syntax...register a renderer like
djangoToBeans object that answers getFooDisplay and delegates to
django object. Might be Able to use reflection or something to make
this more automatic...
Ter
More information about the stringtemplate-interest
mailing list