When switching to the category category page gives an error:


from django.urls import path
FROM. Views Import *
urlpatterns= [
    PATH ('', NEWS),
    Path ('Category /≪
Int: Category_ID >
/', get_category)


from django.shortcuts import render
from django.http import httpresponse
from .models Import News, Category
DEF NEWS (Request):
    news= news.Objects.all ()
    Categories= Category.Objects.all ()
    context= {
        'NEWS': News,
        'Title': 'News List',
        Categories': Categories,
    Return Render (Request, template_name= 'news /index.html', context= context)
DEF Get_category (Request, Category_ID):
    News= news.Objects.Filter (Category_id= Category_id)
    Categories= Category.Objects.all ()
    Category= Category.Objects.get (PK= Category_id)
    Return Render (Render, 'News /Category.html', {'NEWS': News, 'Categories': Categories, 'Category': Category}) Probably?

andreymal2021-04-05 15:47:16

There is no such page.

Миша2021-04-05 16:17:56