Fix other test warnings

One about timezones, the other about a deprecationwarning
parent a4521fff
import os
from django.conf import settings
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
from django.utils import timezone
......@@ -44,7 +45,7 @@ def get_document(request, pk):
document = get_object_or_404(Document, pk=int(pk))
if document.members_only and not request.user.is_authenticated:
return redirect('/login/?next=%s' % request.path)
return redirect('{}?next={}'.format(settings.LOGIN_URL, request.path))
try:
file = document.file
......
......@@ -188,7 +188,7 @@ class ServicesTest(TestCase):
self.assertEqual(reg.member, self.member)
self.assertEqual(reg.date_cancelled, None)
reg.date_cancelled = datetime(2017, 9, 1)
reg.date_cancelled = timezone.make_aware(datetime(2017, 9, 1))
reg.save()
reg = services.create_registration(self.member, self.event)
......@@ -267,7 +267,7 @@ class ServicesTest(TestCase):
Registration.objects.create(
event=self.event,
member=Member.objects.filter(username="testuser").first(),
date=datetime(2017, 9, 1)
date=timezone.make_aware(datetime(2017, 9, 1))
)
services.cancel_registration(None, self.member, self.event)
......
......@@ -34,7 +34,7 @@ from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import login
from django.contrib.auth.views import LoginView
from django.contrib.sitemaps.views import sitemap
from django.views.generic import TemplateView
from django.views.i18n import JavaScriptCatalog
......@@ -113,7 +113,7 @@ urlpatterns = [
url(r'^announcements/', include('announcements.urls')),
url(r'^pushnotifications/', include('pushnotifications.urls')),
# Default login helpers
url(r'^login/$', login, {'authentication_form': AuthenticationForm},
url(r'^login/$', LoginView.as_view(), {'authentication_form': AuthenticationForm},
name='login'),
url(r'^', include('django.contrib.auth.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment