I am using Django (and Python) for the first time, and I am looking for the right solution for an included template, which may or may not have a value provided.
For example, this template will always have a company defined, but it may not always have a user. If the "user" is not defined, then you need to define, for example:
<% with guy=(user if user != None else company.admin_user) %>
But I did not find a good way to do this. In some cases, the user will be determined by the inclusion of the template, in other cases, the template must find the default user.
Edit: Solution according to Ignacio's answer:
<% with guy=user|default:company.admin_user %>
source share