I've tried to build the simplest possible form in Sprox using pyramid.
# model.py
class Allocation:
# some fields ...
class SproxForm(AddRecordForm):
__model__ = Allocation
sprox_form = SproxForm(DBSession)
# views.py
def sprox_form(request):
return {'f':sprox_form,'kw':{}}
<html>
<body>
<div tal:content="structure f(kw)"/>
</body>
</html>
But it just prints out {'kw': {}, 'f': }
The forms tutorial is written using TurboGears2 and I am unable to translate it to pyramid, because I am new to pyramid.
So could someone tell me what am I doing wrong, or show me a short (but complete) example, which uses pyramid?
Well your form is named
sprox_form
and your view is namedsprox_form
. This ambiguity is gonna be a bad idea. Other than that I can't see anything suspicious, assuming your chameleon syntax is correct. If you were using mako it'd be simply${f(kw)}
although instead off
I might suggest using the namewidget
orform
, and instead ofkw
maybevalue
orform_input
.