Commit a27d00d3 authored by Myriam Begel's avatar Myriam Begel

Page affichant les publications

parent a92f7b1c
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/static/perso_app/style.css">
<meta name="robots" content="index, follow"/>
<title> Page perso de Moi </title>
</head>
<body>
<header>
<img src="/static/perso_app/bouh.png" alt="Moi" id="moi"/>
<h1>Page Perso - Moi</h1>
<nav>
<ul>
<li> <a href="/"> Accueil </a> </li>
<li> <a href="publications"> Publications </a> </li>
<li> <a href="contact"> Contact </a> </li>
</ul>
</nav>
</header>
<section id="publications">
<h2> Publications </h2>
{% for publication in publications %}
<h3> Titre : {{ publication.titre }} </h3>
<p> Auteurs : {{ publication.auteurs }} </p>
<p> Publié
{% if publication.editeur %}
par {{ publication.editeur }}
{% endif %}
le {{ publication.date }}
</p>
<p> {{ publication.description }} </p>
{% endfor %}
</section>
</body>
</html>
......@@ -2,5 +2,6 @@ from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.accueil, name="accueil")
url(r'^$', views.accueil, name="accueil"),
url(r'^publications$', views.publications, name="publications")
]
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from .models import Publication
def accueil(request):
template = loader.get_template('perso_app/index.html')
return HttpResponse(template.render({},request))
return render(request, 'perso_app/index.html', {})
def publications(request):
publications = Publication.objects.order_by('-date')
context = {'publications': publications}
return render(request, 'perso_app/publications.html', context)
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