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.BlogPost', 'fa-rss-square'),
('judge.Comment', 'fa-comment-o'), ('judge.Comment', 'fa-comment-o'),
('judge.Ticket', 'fa-exclamation-circle'),
('flatpages.FlatPage', 'fa-file-text-o'), ('flatpages.FlatPage', 'fa-file-text-o'),
('judge.Solution', 'fa-pencil'), ('judge.Solution', 'fa-pencil'),
], ],
@ -238,6 +239,7 @@ INSTALLED_APPS += (
'django_jinja', 'django_jinja',
'chat_box', 'chat_box',
'channels', 'channels',
'newsletter',
) )
MIDDLEWARE = ( MIDDLEWARE = (
@ -515,3 +517,15 @@ CHANNEL_LAYERS = {
}, },
}, },
} }
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
channels-redis channels-redis
docker docker
django-newsletter
python-memcached python-memcached
netaddr netaddr

View file

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

View file

@ -1,11 +1,11 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}{{ object.title }} - Newsletter Archive - {{ SITE_LONG_NAME }}{% endblock %} {% block title %}{{ newsletter }} - Newsletter Archive - {{ SITE_LONG_NAME }}{% endblock %}
{% block content_title %}Newsletter Archive: {{ object.title }}{% endblock %} {% block content_title %}Newsletter Archive: {{ newsletter }}{% endblock %}
{% block body %} {% block body %}
<ul> <ul>
{% for submission in latest %} {% 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 %} {% endfor %}
</ul> </ul>
<hr> <hr>