Answer the question
In order to leave comments, you need to log in
How to correctly write the ID of the current post in the urls?
It's been a whole 4 hour in dzhang, previously I studied the wordpress system, which is essentially understandable ..
I have this code:
urlpatterns = [
path('',
ListView.as_view(queryset=Articles.objects.all().order_by("-date")[:20], template_name="news/posts.html")),
path('', DetailView.as_view(model = Articles, template_name = "news/post.html"))
]
Answer the question
In order to leave comments, you need to log in
https://docs.djangoproject.com/en/2.1/topics/http/...
Also, if you need an urgent solution but you find it difficult to understand, here is a video that explains everything:
- Youtube
And the solution to the problem itself: siteurl//
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question