소스 검색

newsletter, list view

Juan Carlos 5 년 전
부모
커밋
b364329577
36개의 변경된 파일594개의 추가작업 그리고 10개의 파일을 삭제
  1. 7 0
      marktplatz/static/css/styles.css
  2. 66 0
      marktplatz/templates/marktplatz/product_list.html
  3. 0 7
      marktplatz/templates/marktplatz/product_overview.html
  4. 2 0
      marktplatz/urls.py
  5. 44 0
      marktplatz/views.py
  6. 16 0
      project_base/settings.py
  7. 15 0
      project_base/templates/newsletter/common.html
  8. 32 0
      project_base/templates/newsletter/message/message.html
  9. 15 0
      project_base/templates/newsletter/message/message.txt
  10. 1 0
      project_base/templates/newsletter/message/message_subject.txt
  11. 20 0
      project_base/templates/newsletter/message/subscribe.html
  12. 9 0
      project_base/templates/newsletter/message/subscribe.txt
  13. 1 0
      project_base/templates/newsletter/message/subscribe_subject.txt
  14. 19 0
      project_base/templates/newsletter/message/unsubscribe.html
  15. 9 0
      project_base/templates/newsletter/message/unsubscribe.txt
  16. 1 0
      project_base/templates/newsletter/message/unsubscribe_subject.txt
  17. 19 0
      project_base/templates/newsletter/message/update.html
  18. 9 0
      project_base/templates/newsletter/message/update.txt
  19. 1 0
      project_base/templates/newsletter/message/update_subject.txt
  20. 30 0
      project_base/templates/newsletter/newsletter_detail.html
  21. 41 0
      project_base/templates/newsletter/newsletter_list.html
  22. 21 0
      project_base/templates/newsletter/submission_archive.html
  23. 15 0
      project_base/templates/newsletter/subscription_activate.html
  24. 25 0
      project_base/templates/newsletter/subscription_subscribe.html
  25. 11 0
      project_base/templates/newsletter/subscription_subscribe_activated.html
  26. 11 0
      project_base/templates/newsletter/subscription_subscribe_email_sent.html
  27. 25 0
      project_base/templates/newsletter/subscription_subscribe_user.html
  28. 25 0
      project_base/templates/newsletter/subscription_unsubscribe.html
  29. 11 0
      project_base/templates/newsletter/subscription_unsubscribe_activated.html
  30. 11 0
      project_base/templates/newsletter/subscription_unsubscribe_email_sent.html
  31. 27 0
      project_base/templates/newsletter/subscription_unsubscribe_user.html
  32. 25 0
      project_base/templates/newsletter/subscription_update.html
  33. 11 0
      project_base/templates/newsletter/subscription_update_activated.html
  34. 11 0
      project_base/templates/newsletter/subscription_update_email_sent.html
  35. 3 1
      project_base/urls.py
  36. 5 2
      requirements.txt

+ 7 - 0
marktplatz/static/css/styles.css

@@ -293,7 +293,14 @@ img.vote {
     background-color: #AB5120;
 }
 
+.division-color{
 
+border-bottom: 1px solid #AB5120;
+margin-right: -15px;
+margin-left: -15px;
+margin-top: 0;
+/* margin-bottom: 0; */
+}
 
 
 button{

+ 66 - 0
marktplatz/templates/marktplatz/product_list.html

@@ -0,0 +1,66 @@
+{% extends "base_generic.html" %}
+{% load tags %}
+
+{% block content %}
+
+<div class="container-fluid">
+
+<h3 style="margin-top: 10px">Liste</h3>
+
+<!-- ----------------------------------------------------------------------- -->
+
+
+{% if product_list %}
+
+<div class="container-fluid">
+
+  {% for product in product_list %}
+
+    {% if forloop.first %}
+      <div class="row">
+
+        <div class="col-sm-2">&nbsp;</div>
+        <div class="col-sm-2">{% field_name product 'name' %}</div>
+        <div class="col-sm-2">{% field_name product 'claim' %}</div>
+        <div class="col-sm-2">{% field_name product 'status' %}</div>
+        <div class="col-sm-2">{% field_name product 'adresse' %}</div>
+        <div class="col-sm-2">{% field_name product 'website' %}</div>
+      </div>
+
+      <div class="row">
+        <div class="col-sm-12" style="background-color: #FFF;">
+          <hr class="division-color">
+        </div>
+      </div>
+    {% endif %}
+
+
+  <div class="row">
+    <div class="col-sm-2"><img src="{{product.media_set.first.image_small.url}}" width="50" height="50" alt="{{ product.pk }}"> </div>
+    <div class="col-sm-2"><a href="{% url 'product-detail' product.pk %}"> {{product.name|upper }} </a></div>
+    <div class="col-sm-2"> <span>{{product.claim }}</span></div>
+    <div class="col-sm-2"> <span>{{product.get_status_display }}</span></div>
+    <div class="col-sm-2"> <span>{{product.adresse }}, {{product.plz }} {{product.adresse_zusatz }} </span> </div>
+    <div class="col-sm-2"><a href="{{ product.website }}"><i class="fas fa-link"></i> {{ product.website }}</a> </div>
+  </div>
+  <div class="row">
+    <div class="col-sm-12" style="background-color: #FFF;">
+      <hr class="division-color">
+    </div>
+  </div>
+  {% endfor %}
+
+</div>
+
+{% else %}
+
+  <div class="">
+    Es gibt keine Produkte.
+  </div>
+
+{% endif %}
+
+<!-- --------------------------------------------------------------- -->
+
+
+{% endblock %}

+ 0 - 7
marktplatz/templates/marktplatz/product_overview.html

@@ -215,14 +215,7 @@ $(document).ready(function(){
   }
 
 
-  .division-color{
 
-  border-bottom: 1px solid #AB5120;
-  margin-right: -15px;
-  margin-left: -15px;
-  margin-top: 0;
-  /* margin-bottom: 0; */
-  }
 
 </style>
 

+ 2 - 0
marktplatz/urls.py

@@ -12,6 +12,8 @@ urlpatterns = [
     path('submit/', views.submit, name='submit'),
     path('products/', views.ProductsView.as_view(), name='products'),
     path('products/search', views.SearchProductsView.as_view(), name='search-products'),
+    path('products-list/', views.ProductsListView.as_view(), name='products-list'),
+    path('products-list/embed', views.ProductsListView.as_view(  embed=True,  ), name='products-list-embed'),
     path('suchagent/', views.SearchAgentCreate.as_view(), name='search-agent-create'),
     path('suchagent/embed', views.SearchAgentCreate.as_view( embed=True, ), name='search-agent-create-embed'),
     path('suchagent/<int:pk>/<slug:hash>/', views.SearchAgentDelete.as_view(), name='search-agent-delete'),

+ 44 - 0
marktplatz/views.py

@@ -323,6 +323,50 @@ class AdminView(LoginRequiredMixin, generic.ListView):
 
 
 
+class ProductsListView(generic.ListView):
+    model = Product
+    template_name='marktplatz/product_list.html'
+    embed = False
+
+    def get_context_data(self, **kwargs):
+            # context = super().get_context_data(**kwargs)
+            # return context
+            if self.embed :
+                kwargs['embed']  = True
+            return super().get_context_data(**kwargs)
+
+    def post(self, request, *args, **kwargs):
+        # print (request.POST.dict())
+        context = request.POST.dict()
+        public = {k: v for k, v in context.items() if k.startswith('product_p')}
+
+        for elemk in public:
+            # print(elemk + " -  " + public[elemk] )
+            keys = elemk.split(".")
+            current_product = Product.objects.get(pk=keys[1])
+            if public[elemk] == 'true':
+                current_product.public = True
+                current_product.save()
+            else:
+                current_product.public = False
+                current_product.save()
+
+        edit = {k: v for k, v in context.items() if k.startswith('product_e')}
+        # print (edit)
+        for elemk in edit:
+            # print(elemk + " -  " + edit[elemk] )
+            keys = elemk.split(".")
+            current_product = Product.objects.get(pk=keys[1])
+            if edit[elemk] == 'true':
+                current_product.edit = True
+                current_product.save()
+            else:
+                current_product.edit = False
+                current_product.save()
+
+        return HttpResponseRedirect('')
+
+
 
 class lightboximg(LoginRequiredMixin, TemplateView):
 

+ 16 - 0
project_base/settings.py

@@ -213,11 +213,15 @@ INSTALLED_APPS = [
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'django.contrib.sites',
     'marktplatz.apps.marktplatzConfig',
     #'constance',
     'project_base.apps.ConstanceBase',
     'constance.backends.database',
+    'sorl.thumbnail',
+    'newsletter',
     'imagekit',
+    'tinymce',
     'multiselectfield',
     'crispy_forms',
     'django_file_form',
@@ -231,6 +235,18 @@ INSTALLED_APPS = [
     'project_base.apps.project_base',
 ]
 
+SITE_ID = 1
+
+NEWSLETTER_CONFIRM_EMAIL_UNSUBSCRIBE = False
+NEWSLETTER_RICHTEXT_WIDGET = "tinymce.widgets.TinyMCE"
+# 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
+
+
 CRISPY_TEMPLATE_PACK = 'bootstrap4'
 
 

+ 15 - 0
project_base/templates/newsletter/common.html

@@ -0,0 +1,15 @@
+{% load i18n %}
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <title>{% block title %}{% trans "Newsletter" %}{% endblock title %}</title>
+        {% block header %}
+        {% endblock header %}
+    </head>
+
+    <body>
+        {% block body %}
+        {% endblock body %}
+    </body>
+</html>

+ 32 - 0
project_base/templates/newsletter/message/message.html

@@ -0,0 +1,32 @@
+{% load thumbnail i18n %}<!DOCTYPE html>
+
+<html>
+<head>
+    <meta charset="utf-8">
+	<title>{{ newsletter.title }}: {{ message.title }}</title>
+</head>
+<body>
+    <h1>{{ newsletter.title }}</h1>
+    <h2>{{ message.title }}</h2>
+    {% for article in message.articles.all %}
+        <h3>{{ article.title }}</h3>
+        
+        {% thumbnail article.image "200x200" as image %}
+            <img src="http://{{ site.domain }}{{ image.url }}" width="{{ image.width }}" height="{{ image.height }}">
+        {% endthumbnail %}
+
+        <div>{{ article.text|safe }}</div>
+        
+        {% if article.url %}
+            <div><a href="{{ article.url }}">{% trans "Read more" %}</a></div>
+        {% endif %}
+    {% endfor %}
+    
+    <ul>
+        {% if submission.publish %}
+        <li><a href="http://{{ site.domain }}{{ submission.get_absolute_url }}">{% trans "Read message online" %}</a></li>
+        {% endif %}
+        <li><a href="http://{{ site.domain }}{% url "newsletter_unsubscribe_request" newsletter.slug %}">{% trans "Unsubscribe" %}</a></li>
+    </ul>
+</body>
+</html>

+ 15 - 0
project_base/templates/newsletter/message/message.txt

@@ -0,0 +1,15 @@
+{% load i18n %}++++++++++++++++++++
+
+{{ newsletter.title }}: {{ message.title }}
+
+++++++++++++++++++++
+
+{% for article in message.articles.all %}
+{{ article.title }}
+{{ article.text|striptags|safe }}
+
+{% endfor %}
+
+++++++++++++++++++++
+
+{% trans "Unsubscribe:" %} http://{{ site }}{% url "newsletter_unsubscribe_request" newsletter.slug %}

+ 1 - 0
project_base/templates/newsletter/message/message_subject.txt

@@ -0,0 +1 @@
+{{ newsletter.title }} - {{ message.title }}

+ 20 - 0
project_base/templates/newsletter/message/subscribe.html

@@ -0,0 +1,20 @@
+{% load i18n %}<!DOCTYPE html>
+
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>{% blocktrans with title=newsletter.title %}Subscription to {{ title }}{% endblocktrans %}
+</title>
+</head>
+<body>
+{% blocktrans with name=subscription.name|default:_("Sir/Madam") title=newsletter.title domain=site.domain url=subscription.subscribe_activate_url %}Dear {{ name }},
+
+you, or someone in your name requested a subscription to {{ title }}.
+
+If you would like to confirm your subscription, please follow this activation link:
+http://{{ domain }}{{ url }}
+
+Kind regards,{% endblocktrans %}
+{{ newsletter.sender }}
+</body>
+</html>

+ 9 - 0
project_base/templates/newsletter/message/subscribe.txt

@@ -0,0 +1,9 @@
+{% load i18n %}{% blocktrans with name=subscription.name|default:_("Sir/Madam") title=newsletter.title domain=site.domain url=subscription.subscribe_activate_url %}Dear {{ name }},
+
+you, or someone in your name requested a subscription to {{ title }}.
+
+If you would like to confirm your subscription, please follow this activation link:
+http://{{ domain }}{{ url }}
+
+Kind regards,{% endblocktrans %}
+{{ newsletter.sender }}

+ 1 - 0
project_base/templates/newsletter/message/subscribe_subject.txt

@@ -0,0 +1 @@
+{% load i18n %}{{ newsletter.title }} - {% trans "Confirm subscription" %}

+ 19 - 0
project_base/templates/newsletter/message/unsubscribe.html

@@ -0,0 +1,19 @@
+{% load i18n %}<!DOCTYPE html>
+
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>{% blocktrans with title=newsletter.title %}Unsubscription from {{ title }}{% endblocktrans %}</title>
+</head>
+<body>
+{% blocktrans with name=subscription.name|default:_("Sir/Madam") title=newsletter.title domain=site.domain url=subscription.unsubscribe_activate_url %}Dear {{ name }},
+
+you, or someone in your name requested unsubscription from {{ title }}.
+
+If you would like to confirm your unsubscription, please follow this activation link:
+http://{{ domain }}{{ url }}
+
+Kind regards,{% endblocktrans %}
+{{ newsletter.sender }}
+</body>
+</html>

+ 9 - 0
project_base/templates/newsletter/message/unsubscribe.txt

@@ -0,0 +1,9 @@
+{% load i18n %}{% blocktrans with name=subscription.name|default:_("Sir/Madam") title=newsletter.title domain=site.domain url=subscription.unsubscribe_activate_url %}Dear {{ name }},
+
+you, or someone in your name requested unsubscription from {{ title }}.
+
+If you would like to confirm your unsubscription, please follow this activation link:
+http://{{ domain }}{{ url }}
+
+Kind regards,{% endblocktrans %}
+{{ newsletter.sender }}

+ 1 - 0
project_base/templates/newsletter/message/unsubscribe_subject.txt

@@ -0,0 +1 @@
+{% load i18n %}{{ newsletter.title }} - {% trans "Confirm unsubscription" %}

+ 19 - 0
project_base/templates/newsletter/message/update.html

@@ -0,0 +1,19 @@
+{% load i18n %}<!DOCTYPE html>
+
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>{% blocktrans with title=newsletter.title %}Update of subscription to {{ title }}{% endblocktrans %}</title>
+</head>
+<body>
+{% blocktrans with name=subscription.name|default:_("Sir/Madam") title=newsletter.title domain=site.domain url=subscription.update_activate_url %}Dear {{ name }},
+
+you, or someone in your name requested updating your personal information for {{ title }}.
+
+To make changes to your information in our database, please follow this activation link:
+http://{{ domain }}{{ url }}
+
+Kind regards,{% endblocktrans %}
+{{ newsletter.sender }}
+</body>
+</html>

+ 9 - 0
project_base/templates/newsletter/message/update.txt

@@ -0,0 +1,9 @@
+{% load i18n %}{% blocktrans with name=subscription.name|default:_("Sir/Madam") title=newsletter.title domain=site.domain url=subscription.update_activate_url %}Dear {{ name }},
+
+you, or someone in your name requested updating your personal information for {{ title }}.
+
+To make changes to your information in our database, please follow this activation link:
+http://{{ domain }}{{ url }}
+
+Kind regards,{% endblocktrans %}
+{{ newsletter.sender }}

+ 1 - 0
project_base/templates/newsletter/message/update_subject.txt

@@ -0,0 +1 @@
+{% load i18n %}{{ newsletter.title }} - {% trans "Update information" %}

+ 30 - 0
project_base/templates/newsletter/newsletter_detail.html

@@ -0,0 +1,30 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter detail" %}{% endblock title %}
+
+{% block body %}
+<table>
+    <tr>
+        <th>{% trans "Newsletter" %} {{ object.title }}</th>
+    </tr>
+    <tr>
+        <td><a href="{% url "newsletter_subscribe_request" object.slug %}">{% trans "Subscribe" %}</a></td>
+    </tr>
+    {% if not user.is_authenticated %}
+    <tr>
+        <td><a href="{% url "newsletter_update_request" object.slug %}">{% trans "Update" %}</a></td>
+    </tr>
+    {% endif %}
+    <tr>
+        <td><a href="{% url "newsletter_unsubscribe_request" object.slug %}">{% trans "Unsubscribe" %}</a></td>
+    </tr>
+    <tr>
+        <td><a href="{% url "newsletter_archive" object.slug %}">{% trans "Archive" %}</a></td>
+    </tr>
+    <tr>
+        <td><a href="../">{% trans "Back to list" %}</a></td>
+    </tr>
+</table>
+{% endblock body %}

+ 41 - 0
project_base/templates/newsletter/newsletter_list.html

@@ -0,0 +1,41 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter list" %}{% endblock title %}
+
+{% block body %}
+{% if user.is_authenticated %}
+<form method="POST" action="">
+  {% csrf_token %}
+  {{ formset.management_form }}
+  <table>
+    <tr>
+        <th>{% trans "Newsletter" %}</th>
+        {% if user %}
+        <th>{% trans "Subscribe" %}</th>
+        {% endif %}
+    </tr>
+    {% for form in formset.forms %}
+      <tr>
+        <td>{{ form.id }}{{ form.newsletter }}
+<a href="{% url "newsletter_detail" form.instance.newsletter.slug %}">{{ form.instance.newsletter.title }}</a></td>
+        <td>{{ form.subscribed }}</td>
+      </tr>
+    {% endfor %}
+  </table>
+  <p><input id="id_submit" name="submit" value="{% trans "Update subscriptions" %}" type="submit" /></p>
+</form>
+{% else %}
+<table>
+    <tr>
+        <th>{% trans "Newsletter" %}</th>
+    </tr>
+    {% for newsletter in object_list %}
+    <tr>
+        <td><a href="{% url "newsletter_detail" newsletter.slug %}">{{ newsletter.title }}</a></td>
+    </tr>
+    {% endfor %}
+</table>
+{% endif %}
+{% endblock body %}

+ 21 - 0
project_base/templates/newsletter/submission_archive.html

@@ -0,0 +1,21 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter archive" %}{% endblock title %}
+
+{% block body %}
+<table>
+    <tr>
+        <th>{% trans "Newsletter archive" %} {{ newsletter.title }}</th>
+    </tr>
+    {% for submission in latest %}
+    <tr>
+        <td><a href="{{ submission.get_absolute_url }}">{{ submission }}</a></td>
+    </tr>
+    {% endfor %}
+    <tr>
+        <td><a href="../">{% trans "Back to list" %}</a></td>
+    </tr>
+</table>
+{% endblock body %}

+ 15 - 0
project_base/templates/newsletter/subscription_activate.html

@@ -0,0 +1,15 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}</h1>
+
+    <form enctype="multipart/form-data" method="post" action=".">
+        {% csrf_token %}
+        {{ form.as_p }}
+        <p><input id="id_submit" name="submit" value="{% trans "Activate" %}" type="submit" /></p>
+    </form>
+{% endblock body %}

+ 25 - 0
project_base/templates/newsletter/subscription_subscribe.html

@@ -0,0 +1,25 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter subscribe" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter subscribe" %} {{ newsletter.title }}</h1>
+
+    {% if error %}
+        <p>{% trans "Due to a technical error we were not able to submit your confirmation email. This could be because your email address is invalid." %}</p>
+
+        {% comment %} Replace the the following dummy with a valid email address and remove this comment.
+
+        <p>{% trans "If the error persists, please don't hesitate to contact us at the following email address:" %} <a href="mailto:office@realitylab.at">office@realitylab.at</a></p>
+
+        {% endcomment %}
+    {% else %}
+        <form enctype="multipart/form-data" method="post" action=".">
+            {% csrf_token %}
+            {{ form.as_p }}
+            <p><input id="id_submit" name="submit" value="{% trans "Subscribe" %}" type="submit" /></p>
+        </form>
+    {% endif %}
+{% endblock body %}

+ 11 - 0
project_base/templates/newsletter/subscription_subscribe_activated.html

@@ -0,0 +1,11 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}</h1>
+
+    <p>{% trans "Your subscription has successfully been activated." %}</p>
+{% endblock body %}

+ 11 - 0
project_base/templates/newsletter/subscription_subscribe_email_sent.html

@@ -0,0 +1,11 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter subscribe" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter subscribe" %} {{ newsletter.title }}</h1>
+
+    <p>{% trans "Your subscription request was successfully received and an activation email has been sent to you. In that email you will find a link which you need to follow in order to activate your subscription." %}</p>
+{% endblock body %}

+ 25 - 0
project_base/templates/newsletter/subscription_subscribe_user.html

@@ -0,0 +1,25 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter subscribe" %}{% endblock title %}
+
+{% block body %}
+<h1>{% trans "Newsletter subscribe" %} {{ newsletter.title }}</h1>
+
+<p>Welcome, {{ user }}!</p>
+
+{% if messages %}
+<ul>
+    {% for message in messages %}
+    <li>{{ message }}</li>
+    {% endfor %}
+</ul>
+{% else %}
+{% trans "Do you want to subscribe to this newsletter?" %}
+<form enctype="multipart/form-data" method="post" action="{% url "newsletter_subscribe_confirm" newsletter.slug %}">
+    {% csrf_token %}
+    <p><input id="id_submit" name="submit" value="{% trans "Subscribe" %}" type="submit" /></p>
+</form>
+{% endif %}
+{% endblock body %}

+ 25 - 0
project_base/templates/newsletter/subscription_unsubscribe.html

@@ -0,0 +1,25 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter unsubscribe" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter unsubscribe" %} {{ newsletter.title }}</h1>
+
+    {% if error %}
+        <p>{% trans "Due to a technical error we were not able to submit your confirmation email. This could be because your email address is invalid." %}</p>
+
+        {% comment %} Replace the the following dummy with a valid email address and remove this comment.
+
+        <p>{% trans "If the error persists, please don't hesitate to contact us at the following email address:" %} <a href="mailto:office@realitylab.at">office@realitylab.at</a></p>
+
+        {% endcomment %}
+    {% else %}
+        <form enctype="multipart/form-data" method="post" action=".">
+            {% csrf_token %}
+            {{ form.as_p }}
+            <p><input id="id_submit" name="submit" value="{% trans "Unsubscribe" %}" type="submit" /></p>
+        </form>
+    {% endif %}
+{% endblock body %}

+ 11 - 0
project_base/templates/newsletter/subscription_unsubscribe_activated.html

@@ -0,0 +1,11 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}</h1>
+
+    <p>{% trans "You have successfully been unsubscribed." %}</p>
+{% endblock body %}

+ 11 - 0
project_base/templates/newsletter/subscription_unsubscribe_email_sent.html

@@ -0,0 +1,11 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter unsubscribe" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter unsubscribe" %} {{ newsletter.title }}</h1>
+
+    <p>{% trans "Your unsubscription request has successfully been received. An email has been sent to you with a link you need to follow in order to confirm your unsubscription." %}</p>
+{% endblock body %}

+ 27 - 0
project_base/templates/newsletter/subscription_unsubscribe_user.html

@@ -0,0 +1,27 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter unsubscribe" %}{% endblock title %}
+
+{% block body %}
+<h1>{% trans "Newsletter unsubscribe" %} {{ newsletter.title }}</h1>
+
+<p>Welcome, {{ user }}!</p>
+
+{% if messages %}
+<ul>
+    {% for message in messages %}
+    <li>{{ message }}</li>
+    {% endfor %}
+</ul>
+{% else %}
+
+{% trans "Do you want to unsubscribe from this newsletter?" %}
+<form enctype="multipart/form-data" method="post" action="{% url "newsletter_unsubscribe_confirm" newsletter.slug %}">
+    {% csrf_token %}
+    <p><input id="id_submit" name="submit" value="{% trans "Unsubscribe" %}" type="submit" /></p>
+</form>
+{% endif %}
+
+{% endblock body %}

+ 25 - 0
project_base/templates/newsletter/subscription_update.html

@@ -0,0 +1,25 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter update" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter update" %} {{ newsletter.title }}</h1>
+
+    {% if error %}
+        <p>{% trans "Due to a technical error we were not able to submit your confirmation email. This could be because your email address is invalid." %}</p>
+
+        {% comment %} Replace the the following dummy with a valid email address and remove this comment.
+
+        <p>{% trans "If the error persists, please don't hesitate to contact us at the following email address:" %} <a href="mailto:office@realitylab.at">office@realitylab.at</a></p>
+
+        {% endcomment %}
+    {% else %}
+        <form enctype="multipart/form-data" method="post" action=".">
+            {% csrf_token %}
+            {{ form.as_p }}
+            <p><input id="id_submit" name="submit" value="{% trans "Update subscription" %}" type="submit" /></p>
+        </form>
+    {% endif %}
+{% endblock body %}

+ 11 - 0
project_base/templates/newsletter/subscription_update_activated.html

@@ -0,0 +1,11 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}</h1>
+
+    <p>{% trans "Your subscription has successfully been updated." %}</p>
+{% endblock body %}

+ 11 - 0
project_base/templates/newsletter/subscription_update_email_sent.html

@@ -0,0 +1,11 @@
+{% extends "newsletter/common.html" %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Newsletter update" %}{% endblock title %}
+
+{% block body %}
+    <h1>{% trans "Newsletter update" %} {{ newsletter.title }}</h1>
+
+    <p>{% trans "Your update request was successfully received and an activation email has been sent to you. In that email you will find a link which you need to follow in order to update your subscription." %}</p>
+{% endblock body %}

+ 3 - 1
project_base/urls.py

@@ -19,7 +19,7 @@ from django.views.generic import RedirectView
 from django.conf import settings
 from django.conf.urls.static import static
 from django.contrib.auth import views as auth_views
-from django.urls import include, path
+from django.urls import include, path, re_path
 
 from django.conf.urls import url, include
 from . import views
@@ -63,6 +63,8 @@ urlpatterns = [
     path('', RedirectView.as_view(url='/mab/')),
 
     path('accounts/', include('django.contrib.auth.urls')),
+    path('newsletter/', include('newsletter.urls')),
+    path('tinymce/', include('tinymce.urls')),
     url(r'^upload/', include('django_file_form.urls')),
     url(r'^handle_upload$', views.handle_upload, name='file_form_handle_upload'),
     path('__debug__/', include(debug_toolbar.urls)),

+ 5 - 2
requirements.txt

@@ -1,4 +1,4 @@
-django==2.2.10
+django==3.1.3
 django-htmlmin==0.10.0
 Pillow==6.2.0
 django-smtp-ssl==1.0
@@ -13,4 +13,7 @@ django-simple-captcha==0.5.12
 django-multiselectfield==0.1.12
 django-debug-toolbar==3.1.1
 django-post_office==3.1.0
- django-fullurl==1.1
+django-fullurl==1.1
+sorl-thumbnail==12.6.3
+django-newsletter==3.1.3
+django-tinymce==3.1.0