Add check for empty offer

This commit is contained in:
Dave Gallant
2024-01-16 21:29:04 -05:00
parent 8195317e29
commit 112a807102
3 changed files with 10 additions and 6 deletions

View File

@@ -18,12 +18,17 @@ def send_notification(
apobj = apprise.Apprise()
apobj.add(servers)
if topic.offer:
dealer_name = topic.offer.dealer_name
else:
dealer_name = ""
subject = topic.title
body = f"""\
<b>Post age:</b> {datetime.now(timezone.utc) - datetime.fromisoformat(topic.post_time)}
<br>
<br>
<b>Dealer:</b> {topic.offer.dealer_name}
<b>Dealer:</b> {dealer_name}
<br>
<br>
<b>Deal:</b> {topic.title}