Add newsletter

This commit is contained in:
cuom1999 2020-08-02 17:34:20 -05:00
parent 8f6507fdab
commit 991835e4f4
4 changed files with 30 additions and 7 deletions

View file

@ -203,6 +203,7 @@ else:
},
('judge.BlogPost', 'fa-rss-square'),
('judge.Comment', 'fa-comment-o'),
('judge.Ticket', 'fa-exclamation-circle'),
('flatpages.FlatPage', 'fa-file-text-o'),
('judge.Solution', 'fa-pencil'),
],
@ -238,6 +239,7 @@ INSTALLED_APPS += (
'django_jinja',
'chat_box',
'channels',
'newsletter',
)
MIDDLEWARE = (
@ -514,4 +516,16 @@ CHANNEL_LAYERS = {
"hosts": [('0.0.0.0', 6379)],
},
},
}
}
NEWSLETTER_CONFIRM_EMAIL = False
# Amount of seconds to wait between each email. Here 100ms is used.
NEWSLETTER_EMAIL_DELAY = 0.1
# Amount of seconds to wait between each batch. Here one minute is used.
NEWSLETTER_BATCH_DELAY = 60
# Number of emails in one batch
NEWSLETTER_BATCH_SIZE = 100

View file

@ -33,5 +33,6 @@ sqlparse
channels
channels-redis
docker
django-newsletter
python-memcached
netaddr

View file

@ -2,23 +2,31 @@
{% block title %}Newsletter list - {{ SITE_LONG_NAME }}{% endblock %}
{% block content_title %}Newsletter list{% endblock %}
{% block media %}
<style>
* {
box-sizing: border-box;
}
</style>
{% endblock %}
{% block body %}
{% if request.user.is_authenticated %}
<form method="POST" action="" class="form-area">
{% csrf_token %}
{{ formset.management_form }}
<table>
<table class="table">
<tr>
<th>Newsletter</th>
<th>Subscribe</th>
</tr>
{% for form in formset.forms %}
<tr>
<td>{{ form.id }}{{ form.newsletter }}
<td>{{ form.id }}
<a href="{{ url('newsletter_archive', form.instance.newsletter.slug) }}">
{{ form.instance.newsletter.title }}</a>
</td>
<td>{{ form.subscribed }}</td>
<td>{{ form.subscribed }}</d>
</tr>
{% endfor %}
</table>

View file

@ -1,11 +1,11 @@
{% extends "base.html" %}
{% block title %}{{ object.title }} - Newsletter Archive - {{ SITE_LONG_NAME }}{% endblock %}
{% block content_title %}Newsletter Archive: {{ object.title }}{% endblock %}
{% block title %}{{ newsletter }} - Newsletter Archive - {{ SITE_LONG_NAME }}{% endblock %}
{% block content_title %}Newsletter Archive: {{ newsletter }}{% endblock %}
{% block body %}
<ul>
{% for submission in latest %}
<li><a href="{{ submission.get_absolute_url }}">{{ submission }}</a></li>
<li><a href="{{ submission.get_absolute_url() }}">{{ submission }}</a></li>
{% endfor %}
</ul>
<hr>