There is a way to write a view in Plone only with Python so without TAL Expressions. But can I also fill a table dynamically (without using JQuery, Ajax) and display it. Because I have a table whose content changes occasionally and I want this to be displayed dynamically in the view of Plone.
You need at least a template using the main_template where you can fill any arbitraty HTML generated through a browser view method…That’s where you put your own Python code generating your own HTML in whatever way you need or want.
the content of <h1> will be the value of your content types field 'some field' while the content of ${view/some_calculation} will be whatever is returned from your view.py, which would be something like:
from Products.Five.browser import BrowserView
class PersonView(BrowserView):
def some_calculation(self):
build / calculate your table here
return table
It is not often you need to use so much TAL, you can do things like (instead of tal:attributes etc)
${context/some_calculation} can return 'all the body html'. I am not sure what the benefits of doing everything in python would be, but it is possibl as tiberiuichim said. I have only done that for 'download views', 'javascript/css' helper views so I have no examples.
Is there a reason why you want to do it like this? Is it not better to keep the logic and the html apart?
Views are not static. Every time you view a page it is generated from scratch, so you can make a view using a template and render dynamic content into a table.
I'm still a bit confused on what you want to accomplish or why you don't want to use a template?