Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion config/v3_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from django.urls import path, re_path

from core.views import LearnPageView, V3ComponentDemoView
from news.views import V3AllTypesCreateView
from news.views import V3AllTypesCreateView, V3AllTypesEditView, V3DeletePostView
from users.views import (
V3LoginView,
V3PasswordResetDoneView,
Expand All @@ -73,6 +73,16 @@
V3AllTypesCreateView.as_view(),
name="v3-news-create",
),
path(
"v3/news/delete/<slug:slug>/",
V3DeletePostView.as_view(),
name="v3-news-delete",
),
path(
"v3/news/edit/<slug:slug>/",
V3AllTypesEditView.as_view(),
name="v3-news-edit",
),
path(
"v3/accounts/login/",
V3LoginView.as_view(),
Expand Down
10 changes: 10 additions & 0 deletions news/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ def image_url(self):
else:
return self.image.url

@property
def needs_approval(self):
return not self.approved_at and not self.deleted_at

@cached_property
def tag(self):
return getattr(self, "_tag", self.news_type)
Expand Down Expand Up @@ -299,6 +303,12 @@ def can_delete(self, user):
def author_needs_moderation(self):
return acl.author_needs_moderation(self)

def edit_url(self):
return reverse("news-update", kwargs={"slug": self.slug})

def delete_url(self):
return reverse("news-delete", kwargs={"slug": self.slug})
Comment on lines +306 to +310

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 5 '\.(edit_url|delete_url)\b|edit_url\(\)|delete_url\(\)' \
  news pages templates config

rg -n -C 5 'news-update|news-delete|v3-news-edit|v3-news-delete' \
  news pages templates config

Repository: boostorg/website-v2

Length of output: 16303


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- news/models.py Entry and related classes ---'
sed -n '240,325p' news/models.py

printf '%s\n' '--- pages/models.py PostPage and URL helpers ---'
sed -n '220,290p' pages/models.py

printf '%s\n' '--- V3 detail view/context references ---'
rg -n -C 5 'templates/news/v3/detail\.html|detail\.html|PostPage|user_can_edit|user_can_delete' news pages config

Repository: boostorg/website-v2

Length of output: 37728


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- V3 mixin and Entry detail flow ---'
rg -n -C 8 'class V3Mixin|_v3_active|v3_template_name|EntryDetailView' core news config
sed -n '250,355p' news/views.py

printf '%s\n' '--- V3 and legacy URL inclusion ---'
rg -n -C 6 'include\(|v3_urls|news.urls|EntryDetailView|V3AllTypesEditView|V3DeletePostView' config news

Repository: boostorg/website-v2

Length of output: 35204


Route Entry actions through the V3 workflow. When the v3 flag is active, EntryDetailView renders news/v3/detail.html with an Entry object. The template calls object.edit_url and object.delete_url, which resolve legacy routes. Use V3 route names for these actions, or provide separate helpers for legacy and V3 templates.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@news/models.py` around lines 302 - 306, Update Entry.edit_url and
Entry.delete_url to resolve the V3 action routes when the v3 workflow is active,
while preserving legacy route behavior for non-V3 templates; alternatively, add
separate V3 URL helpers and update the V3 detail template to use them.



class News(Entry):
news_type = "news"
Expand Down
Loading
Loading