I first set up a good old Django view with a URL like "/myobj/1" but I
couldn't reuse the LFC portal template with tabs, templates, etc.
Obviously they are missing from the template context.
So I set up a BaseContent with the object id as a query parameter ("?id=1").
But I can't access request to get the value back.
The template basically looks like:
<h2>{{ lfc_context.my_obj.title }}</h2>
And in the model of the object being published:
def my_obj(self):
id = ... something...
return MyObj(id=id)
Portals would do what I want for example:
def render(self, context):
request = context.get('request')
id = request.GET['id']
Is there some way to get the request being published when rendering
content views?
In the end, a recipe to combine basic django views and the LFC portal
template would be appreciated. Maybe by reusing lfc.views.base_view?
Thanks,
Herv�
In the meantime I found the "portal" view just above the latter.
I just had to copy the code because I wanted to change the template and
the context.
A slight modification like this one could avoid code duplication :
def portal(request, obj, template_name="lfc/portal.html", **kwargs):
"""Displays the the portal.
"""
context = {
"portal" : lfc.utils.get_portal()
}
context.update(kwargs)
return render_to_response(template_name, RequestContext(request,
context))
It's not perfect since portlets at the root level are not rendered but
it will do for now.
Herv�