better ordering for tags
[redakcja.git] / redakcja / views.py
index a3045db..948a374 100644 (file)
@@ -1,11 +1,19 @@
+# -*- coding: utf-8 -*-
+#
+# This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
 from django.shortcuts import render, redirect
 from django.contrib.auth import authenticate, login
 from django.contrib.auth.models import User
 from django.core.mail import send_mail
 from django.shortcuts import render, redirect
 from django.contrib.auth import authenticate, login
 from django.contrib.auth.models import User
 from django.core.mail import send_mail
+from honeypot.decorators import check_honeypot
+
 from .forms import RegistrationForm
 from catalogue.models import Document
 from organizations.models import Organization
 
 from .forms import RegistrationForm
 from catalogue.models import Document
 from organizations.models import Organization
 
+
 def main(request):
     upcoming = Document.objects.filter(deleted=False).filter(publish_log=None)
     finished = Document.objects.filter(deleted=False).exclude(publish_log=None)
 def main(request):
     upcoming = Document.objects.filter(deleted=False).filter(publish_log=None)
     finished = Document.objects.filter(deleted=False).exclude(publish_log=None)
@@ -17,7 +25,6 @@ def main(request):
     finished = finished[:8]
     organizations = organizations[:8]
 
     finished = finished[:8]
     organizations = organizations[:8]
 
-
     return render(request, 'main.html', {
         'finished': finished,
         'upcoming': upcoming,
     return render(request, 'main.html', {
         'finished': finished,
         'upcoming': upcoming,
@@ -27,6 +34,8 @@ def main(request):
         'more_organizations': more_organizations,
     })
 
         'more_organizations': more_organizations,
     })
 
+
+@check_honeypot
 def register(request):
     if request.method == 'POST':
         form = RegistrationForm(request.POST, request.FILES)
 def register(request):
     if request.method == 'POST':
         form = RegistrationForm(request.POST, request.FILES)
@@ -40,8 +49,9 @@ def register(request):
             u.set_password(form.cleaned_data['password'])
             u.save()
             login(request, authenticate(username=form.cleaned_data['email'], password=form.cleaned_data['password']))
             u.set_password(form.cleaned_data['password'])
             u.save()
             login(request, authenticate(username=form.cleaned_data['email'], password=form.cleaned_data['password']))
-            send_mail('Registered at MIL/PEER',
-'''You have been successfully registered at MIL/PEER with this e-mail address.
+            send_mail(
+                'Registered at MIL/PEER',
+                '''You have been successfully registered at MIL/PEER with this e-mail address.
 
 Thank you.
 
 
 Thank you.