Commit d8fb8c70 authored by Xavier Calabia's avatar Xavier Calabia

root page now redirects to /heroes (which still contains nothing)

urls added for the separate heroes
parent a1d7df9b
<html> <!DOCTYPE html>
<<title>The Will of the Wisps Wiki</title> <html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>The Will of the Wisps Wiki</title>
</head>
<body>
</body>
</html> </html>
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
from django.test import TestCase from django.test import TestCase
class HomePageTest(TestCase): class HomePageTest(TestCase):
def test_uses_heroes_template(self): def test_redirects_to_heros_template(self):
response = self.client.get('/') response = self.client.get('/')
self.assertTemplateUsed(response, 'heroes.html') self.assertTemplateUsed(response, 'heroes.html')
from django.conf.urls import url from django.conf.urls import url
from .views import heros_page from . import views
urlpatterns = [ urlpatterns = [
url(r'$', heros_page, name='heros_page'), url(r'heroes', views.heroes_page, name='heroes_page'),
url(r'\A\Z', views.redirect_to_heroes_page, name='redirect_to_heroes_page'),
url('hero/cloud', views.cloud_info_page, name='cloud_info_page'),
url('hero/sunflowey', views.sunflowey_info_page, name='sunflowey_info_page'),
url('hero/jester', views.jester_info_page, name='jester_info_page'),
] ]
# Create your views here. # Create your views here.
from django.shortcuts import render from django.shortcuts import render, redirect
def heros_page(request): def heroes_page(request):
return render(request, 'heroes.html') return render(request, 'heroes.html')
def redirect_to_heroes_page(request):
return redirect('/heroes')
def cloud_info_page(request):
return render(request, 'hero/detail_cloud.html')
def sunflowey_info_page(request):
return render(request, 'hero/detail_sunflowey.html')
def jester_info_page(request):
return render(request, 'hero/detail_jester.html')
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