how to apply conditional rendereing for recipient data #297
Replies: 1 comment
-
Anymail doesn't render templates. Depending on how your code is written, templates are rendered by either your Email Service Provider (after Anymail calls your ESP's sending API), or by your own code with the Django rendering engine (before you use Anymail to send the message). Since you mention recipient data, I'm guessing that you're using ESP template rendering. Different ESPs have different template syntaxes, and you haven't said which one you're using. Check your ESP's documentation to see how (or whether) they support conditional expressions in their templates. (There's also information in the Anymail docs for each supported ESP that explains how Anymail's If I guessed wrong and you're actually using Django template rendering, then you would use Django's standard If that doesn't help you find an answer, please provide more details: which ESP you're using, whether you're using a template stored at your ESP or one rendered in your Django code, the actual Python code you're trying to use to build and send the email message, and anything you've already tried to solve the problem that didn't work. |
Beta Was this translation helpful? Give feedback.
-
<a href="{{ instance.url }}?access_code=%recipient.access_code%" target="_blank"> <button>Click to View</button> </a>
all i need is if access_code is empty then i dont want the access_code in href attribute.
Beta Was this translation helpful? Give feedback.
All reactions