mirror of
https://github.com/aykhans/series-robot-web.git
synced 2025-04-21 06:13:34 +00:00
Added email templates
This commit is contained in:
parent
0ad9f71f2a
commit
b94de6e428
@ -27,10 +27,9 @@ def send_email(user):
|
||||
for updated_series in series_counter.new_series_list:
|
||||
update_series(updated_series)
|
||||
updated_series.save()
|
||||
message = render_to_string('new_episodes_notification.html', {
|
||||
message = render_to_string('email/maximum_usage_notification.html', {
|
||||
'user': user,
|
||||
'new_series_list': series_counter.new_series_list,
|
||||
'error_series_list': series_counter.error_series,
|
||||
'maximum_usage': str(e)
|
||||
})
|
||||
email = EmailMessage(
|
||||
@ -38,18 +37,27 @@ def send_email(user):
|
||||
)
|
||||
email.send()
|
||||
return
|
||||
return
|
||||
|
||||
if series_len:
|
||||
for updated_series in series_counter.new_series_list:
|
||||
update_series(updated_series)
|
||||
updated_series.series.save()
|
||||
|
||||
message = render_to_string('new_episodes_notification.html', {
|
||||
if series_counter.error_series:
|
||||
message = render_to_string('email/error_series_notification.html', {
|
||||
'user': user,
|
||||
'new_series_list': series_counter.new_series_list,
|
||||
'error_series_list': series_counter.error_series,
|
||||
'maximum_usage': ''
|
||||
'error_series_list': series_counter.error_series
|
||||
})
|
||||
email = EmailMessage(
|
||||
'New Episodes!', message, to=[user.email]
|
||||
)
|
||||
email.send()
|
||||
return
|
||||
|
||||
message = render_to_string('email/error_series_notification.html', {
|
||||
'user': user,
|
||||
'new_series_list': series_counter.new_series_list
|
||||
})
|
||||
email = EmailMessage(
|
||||
'New Episodes!', message, to=[user.email]
|
||||
|
15
src/series/templates/email/error_series_notification.html
Normal file
15
src/series/templates/email/error_series_notification.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% autoescape off %}
|
||||
|
||||
Hi {{ user.username }},
|
||||
There are new episodes of the series you recorded.
|
||||
|
||||
Some series could not be updated:
|
||||
{% for e in error_series_list %}
|
||||
e.title
|
||||
{% endfor %}
|
||||
|
||||
{% for s in new_series_list %}
|
||||
{{s.series.title}}: watched - {{s.series.watched_season}}-{{s.series.watched_episode}}, last - {{s.last_season}}-{{s.last_episode}}, new episodes count - {{s.new_episodes_count}}
|
||||
{% endfor %}
|
||||
|
||||
{% endautoescape %}
|
11
src/series/templates/email/maximum_usage_notification.html
Normal file
11
src/series/templates/email/maximum_usage_notification.html
Normal file
@ -0,0 +1,11 @@
|
||||
{% autoescape off %}
|
||||
|
||||
Hi {{ user.username }},
|
||||
There are new episodes of the series you recorded.
|
||||
|
||||
Some series could not be updated ({{maximum_usage}})
|
||||
{% for s in new_series_list %}
|
||||
{{s.series.title}}: watched - {{s.series.watched_season}}-{{s.series.watched_episode}}, last - {{s.last_season}}-{{s.last_episode}}, new episodes count - {{s.new_episodes_count}}
|
||||
{% endfor %}
|
||||
|
||||
{% endautoescape %}
|
10
src/series/templates/email/new_series_notification.html
Normal file
10
src/series/templates/email/new_series_notification.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% autoescape off %}
|
||||
|
||||
Hi {{ user.username }},
|
||||
There are new episodes of the series you recorded.
|
||||
|
||||
{% for s in new_series_list %}
|
||||
{{s.series.title}}: watched - {{s.series.watched_season}}-{{s.series.watched_episode}}, last - {{s.last_season}}-{{s.last_episode}}, new episodes count - {{s.new_episodes_count}}
|
||||
{% endfor %}
|
||||
|
||||
{% endautoescape %}
|
@ -1,36 +0,0 @@
|
||||
{% autoescape off %}
|
||||
|
||||
Hi {{ user.username }},
|
||||
There are new episodes of the series you recorded.
|
||||
|
||||
{% if maximum_usage %}
|
||||
Some series could not be updated ({{maximum_usage}})
|
||||
|
||||
{% for s in new_series_list %}
|
||||
{{s.series.title}}: watched - {{s.series.watched_season}}-{{s.series.watched_episode}}
|
||||
last - {{s.last_season}}-{{s.last_episode}}
|
||||
new episodes count - {{s.new_episodes_count}}
|
||||
{% endfor %}
|
||||
|
||||
{% else %}
|
||||
{% if error_series_list %}
|
||||
Some series could not be updated:
|
||||
{% for e in error_series_list %}
|
||||
e.title
|
||||
{% endfor %}
|
||||
|
||||
{% for s in new_series_list %}
|
||||
{{s.series.title}}: watched - {{s.series.watched_season}}-{{s.series.watched_episode}}
|
||||
last - {{s.last_season}}-{{s.last_episode}}
|
||||
new episodes count - {{s.new_episodes_count}}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for s in new_series_list %}
|
||||
{{s.series.title}}: watched - {{s.series.watched_season}}-{{s.series.watched_episode}}
|
||||
last - {{s.last_season}}-{{s.last_episode}}
|
||||
new episodes count - {{s.new_episodes_count}}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endautoescape %}
|
Loading…
x
Reference in New Issue
Block a user