templates

This commit is contained in:
Fred 2015-12-21 21:44:29 +01:00
parent 4a88d8a2ff
commit f71a9ef175
4 changed files with 31 additions and 3 deletions

View File

@ -56,7 +56,7 @@ ROOT_URLCONF = 'gwift.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [ 'templates' ],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [

View File

@ -1,3 +1,5 @@
# gwift/urls.py
"""gwift URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
@ -16,6 +18,9 @@ Including another URLconf
from django.conf.urls import include, url
from django.contrib import admin
from wish.views import WishListList
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^$', WishListList.as_view(), name='wishlists'),
]

View File

@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
</head>
<body>
<p>Mes listes de souhaits</p>
<ul>
{% for wishlist in wishlists %}
<li>{{ wishlist.name }}: {{ wishlist.description }}</li>
{% endfor %}
</ul>
</body>
</html>

View File

@ -1,3 +1,10 @@
from django.shortcuts import render
# wish/views.py
# Create your views here.
from django.views.generic import ListView
from .models import Wishlist
class WishListList(ListView):
context_object_name = 'wishlists'
model = Wishlist
template_name = 'wish/list.html'