views:

33

answers:

1

the model is :

class someModel(db.Model):
    name = db.StringProperty()

    def name_is_sss(self):
        return self.name=='sss'

the view is :

    a=someModel()
    a.name='sss'
    path = os.path.join(os.path.dirname(__file__), os.path.join('templates', 'blog/a.html'))
    self.response.out.write(template.render(path, {'a':a}))

and the html is :

{{ a.name_is_sss }}

the page shows :

True 

so i want to make it more useful, and like this:

the model:

class someModel(db.Model):
    name = db.StringProperty()

    def name_is_x(self,x):
        return self.name==x

the html is :

{% a.name_is_x 'www'%}

or

{{ a.name_is_x 'www'}}

but the error is :

TemplateSyntaxError: Invalid block tag: 'a.name_is_x'

or

TemplateSyntaxError: Could not parse the remainder:  'www'

so how to make my method running

thanks

A: 

Did you try this already?

{{ a.name_is_x('www') }}
lenardgabor