From 8a99514c183de46dbfef50141bad772cd00ffca9 Mon Sep 17 00:00:00 2001 From: ajurna Date: Wed, 24 Jun 2015 09:45:50 +0100 Subject: [PATCH] added redirection from / to /comic/ --- cbreader/urls.py | 1 + comic/views.py | 5 ++++- comic_auth/views.py | 3 +-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cbreader/urls.py b/cbreader/urls.py index daccb1a..e5b43b5 100644 --- a/cbreader/urls.py +++ b/cbreader/urls.py @@ -17,6 +17,7 @@ from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ + url(r'^$', 'comic.views.comic_redirect'), url(r'^login/', 'comic_auth.views.comic_login'), url(r'^logout/', 'comic_auth.views.comic_logout'), url(r'^comic/', include('comic.urls')), diff --git a/comic/views.py b/comic/views.py index 76d90e8..864ec36 100644 --- a/comic/views.py +++ b/comic/views.py @@ -1,7 +1,7 @@ from django.http import HttpResponse from django.template import RequestContext from django.utils.http import urlsafe_base64_decode -from django.shortcuts import render +from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from comic.models import Setting, ComicBook @@ -56,3 +56,6 @@ def get_image(_, comic_path, page): full_path = path.join(base_dir, decoded_path) img, content = book.get_image(full_path, page) return HttpResponse(img.read(), content_type=content) + +def comic_redirect(request): + return redirect('/comic/') \ No newline at end of file diff --git a/comic_auth/views.py b/comic_auth/views.py index bfc904b..ac98233 100644 --- a/comic_auth/views.py +++ b/comic_auth/views.py @@ -1,5 +1,4 @@ -from django.shortcuts import render, redirect -from django.shortcuts import RequestContext +from django.shortcuts import render, redirect, RequestContext from django.contrib.auth import authenticate, login, logout