Thanks a lot Carlos, it works as you described and, as a bonus, I figured 
out how to pre-fill values of widgets on add form:

@expose('amandmani.templates.crud_new', inherit=True)
    def new(self,  *args, **kw):
        params = super(AmendmentController_1, self).new(*args, **kw)
        params['rtt'] = self.rtt
        *params['value'] = dict(field_name_1=value_1, 
...field_name_n=value_n)*
        return params



On Monday, January 6, 2014 12:51:15 PM UTC+1, puska wrote:
>
> Hi,
>
> I am trying to customize new.html sprox template in order to show custom 
> text as the page title, based on 
> http://turbogears.readthedocs.org/en/latest/cookbook/Crud/index.html#overriding-templates.
>  To achieve that I customized new.html template to look like this:
>
> <head>
>     <title>${tmpl_context.title} - New ${model} ${*rtt*} - Unos</title>
>     <style>
>         ${Markup(tmpl_context.crud_style)}
>     </style>
> </head>
>
> In order to pass new argument *rtt* I did the following:
>
> class AmendmentController_1(CrudRestController):
>     allow_only = predicates.in_group('users')
>     model = Amendments
>     title = 'Amandmani'
>
>     @expose('amandmani.templates.crud_new', inherit=True)
>     def new(self,  *args, **kw):
>         return super(AmendmentController_1, self).new(*args, **kw)
>
>     class Add_form(AddRecordForm):
>         __model__ = Amendments
>         __omit_fields__ = ['id', 'name_str'] #, 'operator_id', 
> 'output_files', 'barcodes', 'operators', 'access_date'
>         __field_order__ = ['bill_id', 'name', 'desc']
>
>         def __init__(self,  session,  *rtt*,  *args,  **kw):
>             super(AddRecordForm,  self).__init__(session,  *args,  **kw)
>             self.*rtt* = *rtt*
>
>     table = Table(DBSession)
>     table_filler = Table_filler(DBSession)
>     new_form = Add_form(DBSession,  *'Test'*)
>
> but I am getting:
>
> File 
> "/home/puska/src/turbogears/2.3.1/lib/python2.7/site-packages/Genshi-0.7-py2.7-linux-x86_64.egg/genshi/template/eval.py",
>  
> line *413*, in undefined
>
> raise UndefinedError(key, owner=owner)
> UndefinedError: "rtt" not defined
>
> How should arguments be properly passed to a customized template for 
> rendering?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to