1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #35867, Refs #2411 -- Allowed links in admindocs view details summary.

This commit is contained in:
sai-ganesh-03
2024-10-31 19:10:00 +05:30
committed by Sarah Boyce
parent 4fcbdb11b1
commit 968397228f
6 changed files with 32 additions and 6 deletions

View File

@@ -15,7 +15,7 @@
<h1>{{ name }}</h1>
<h2 class="subhead">{{ summary|striptags }}</h2>
<h2 class="subhead">{{ summary }}</h2>
{{ body }}

View File

@@ -242,3 +242,7 @@ def remove_non_capturing_groups(pattern):
final_pattern += pattern[prev_end:start]
prev_end = end
return final_pattern + pattern[prev_end:]
def strip_p_tags(value):
return mark_safe(value.replace("<p>", "").replace("</p>", ""))

View File

@@ -30,7 +30,7 @@ from django.utils.inspect import (
from django.utils.translation import gettext as _
from django.views.generic import TemplateView
from .utils import get_view_name
from .utils import get_view_name, strip_p_tags
# Exclude methods starting with these strings from documentation
MODEL_METHODS_EXCLUDE = ("_", "add_", "delete", "save", "set_")
@@ -195,7 +195,7 @@ class ViewDetailView(BaseAdminDocsView):
**{
**kwargs,
"name": view,
"summary": title,
"summary": strip_p_tags(title),
"body": body,
"meta": metadata,
}
@@ -384,7 +384,7 @@ class ModelDetailView(BaseAdminDocsView):
**{
**kwargs,
"name": opts.label,
"summary": title,
"summary": strip_p_tags(title),
"description": body,
"fields": fields,
"methods": methods,