Commit eb05fd07 authored by Leila's avatar Leila
Browse files

create post_details page

parent 12440506
......@@ -5193,7 +5193,8 @@ button.close {
font-style: normal; }
main {
margin-top: 75px;
margin-left: 15px; }
margin-left: 15px;
height: 80%; }
.navbar-fixed-top {
background-color: #56CEE9;
......
{% load staticfiles %}
{% load i18n %}
{% load cookielaw_tags %}
......@@ -39,11 +38,11 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Cuisine entre amis</a>
<a class="navbar-brand" href="#">Cuisine entre amis</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="menu nav navbar-nav">
<li class="active"><a href="post">Articles</a></li>
<li class="active"><a href="{% url 'post' %}">Articles</a></li>
<li class="active"><a href="{% url 'contact' %}">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
......
......@@ -17,7 +17,9 @@
<div class="intro-pic">
<img src="{{object.intro_pic.url}}">
</div>
<button class="readmore btn btn-sm" type="submit"><a href="#">Read more</a></button>
<button class="readmore btn btn-sm" type="submit">
<a href="{% url 'post_details' object.pk %}">Read more</a>
</button>
</div>
</div>
</div>
......
{% extends "base.html" %}
{% load staticfiles %}
{% block content %}
<div class="title-article">
<h2>{{object.title}}</h2>
</div>
{% endblock %}
from django.views.generic import ListView
from django.views.generic import ListView, DetailView
from django.views.generic.edit import FormView
from django.core.urlresolvers import reverse_lazy
......@@ -24,4 +24,10 @@ class ContactView(FormView):
class PostView(ListView):
model = Post
template_name = 'cuisine_entre_amis/Post.html'
template_name = 'cuisine_entre_amis/post.html'
class PostDetailsView(DetailView):
model = Post
template_name = 'cuisine_entre_amis/post_details.html'
main {
margin-top: $navbar-height*1.5;
margin-left: 15px;
height: 80%;
}
.navbar-fixed-top {
......
......@@ -2,10 +2,9 @@ from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from cuisine_entre_amis.views import ContactView, PostView
from cuisine_entre_amis.views import ContactView, PostView, PostDetailsView
# from cuisine_entre_amis.views import HomeView
......@@ -14,8 +13,8 @@ urlpatterns = [
# Examples:
# url(r'^blog/', include('blog.urls')),
url(r'^$', TemplateView.as_view(template_name='base.html'), name='home'),
url(r'^admin/', include(admin.site.urls)),
url(r'^contact/$', ContactView.as_view(template_name='cuisine_entre_amis/contact.html'), name='contact'),
url(r'^post/$', PostView.as_view(template_name='cuisine_entre_amis/post.html'), name='post'),
url(r'^$', PostView.as_view(template_name='cuisine_entre_amis/post.html'), name='post'),
url(r'^detail/(?P<pk>[0-9]+)/$', PostDetailsView.as_view(template_name='cuisine_entre_amis/post_details.html'), name='post_details'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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