Here is my example cookiecutter.json and Jinja logic
{
"pick_one": [
"Choice A",
"Choice B"
],
"user_name": "{%- if cookiecutter.pick_one == 'Choice A' -%} mydefault {%- else -%} null {%- endif -%}",
"full_name": null
}
Notice that full_name's default value is null, and this means an entry from the user is required.
For user_name, I'd like to have one default based on the pick_one value or null if not that value. In other words, If Choice A is selected, I'd like the default to be mydefault and if not, I'd like null to be the default and user_name to work the same as full_name does in the example.
So far, I've tried wrapping null in curly braces, added safe to it.
{{ null }} or {{ null | safe }} but I get an error that the variable cannot be rendered because 'null' is undefined.
In other attempts, I get the string "null" as a default instead of requiring the user to enter a value.
Thanks so much!