On Monday, June 27, 2011 7:38:39 PM UTC-4, Anthony wrote:
>
> I don't think you can have conditional extend commands like that (extend
> and include are not Python commands -- they are processed by the template
> engine before the Python is run). You can have conditional include commands,
> but technically all of the included views will be included and then
> conditionally executed.
>
> You might be able to do an extend with a variable (set in the controller
> and passed to the view in the returned dict) in place of the view name, but
> in that case, you will not be able to bytecode compile the views because the
> compiler needs to know the extended view at compile time, but it won't
> actually be determined until run time.
>
FYI, I think bytecode compiling yields a significant performance
improvement, particularly for views, so foregoing bytecode for views could
be a bit of a sacrifice. I'm not sure if there's another solution (other
than creating separate desktop and mobile views for individual actions,
which would then extend different layouts).
Anthony