Add PostList view
This commit is contained in:
parent
e071da26dd
commit
6393dd5a5e
3 changed files with 13 additions and 0 deletions
|
|
@ -6,4 +6,5 @@ app_name = "posts"
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("post/<int:pk>", views.PostDetailView.as_view(), name="post_detail"),
|
path("post/<int:pk>", views.PostDetailView.as_view(), name="post_detail"),
|
||||||
path("post/new", views.PostCreateView.as_view(), name="post_create"),
|
path("post/new", views.PostCreateView.as_view(), name="post_create"),
|
||||||
|
path("posts", views.PostListView.as_view(), name="post_list"),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
9
flangr/templates/posts/post_list.html
Normal file
9
flangr/templates/posts/post_list.html
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<h1>Posts Shared with you</h1>
|
||||||
|
<ul>
|
||||||
|
{% for post in object_list %}
|
||||||
|
<li><a href="{% url "posts:post_detail" post.pk %}">{{ post.title }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endblock content %}
|
||||||
|
|
@ -19,11 +19,14 @@ from django.contrib import admin
|
||||||
from django.urls import include
|
from django.urls import include
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
|
from .posts.views import PostListView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
path("accounts/", include("django.contrib.auth.urls")),
|
path("accounts/", include("django.contrib.auth.urls")),
|
||||||
path("posts/", include("flangr.posts.urls")),
|
path("posts/", include("flangr.posts.urls")),
|
||||||
path("circles/", include("flangr.circles.urls")),
|
path("circles/", include("flangr.circles.urls")),
|
||||||
|
path("", PostListView.as_view(), name="home"),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue