aboutsummaryrefslogtreecommitdiff
path: root/blog/views.py
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-05-24 22:47:11 -0400
committerBobby <[email protected]>2023-05-24 22:47:11 -0400
commitcf4c44dd223cd40bec3256fed0defd9a640fc02d (patch)
treeca0db55d929946e7cfcce5248b39982152ea415f /blog/views.py
parent34e20442c502b206e83b0329cc0d4e680e1d2218 (diff)
downloadthatcomputerscientist-cf4c44dd223cd40bec3256fed0defd9a640fc02d.tar.xz
thatcomputerscientist-cf4c44dd223cd40bec3256fed0defd9a640fc02d.zip
Update article page
Diffstat (limited to 'blog/views.py')
-rw-r--r--blog/views.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/blog/views.py b/blog/views.py
index 9fd2b10e..4c10af31 100644
--- a/blog/views.py
+++ b/blog/views.py
@@ -118,6 +118,13 @@ def post(request, slug):
if p.find('br') is not None:
p.decompose()
+ # separate the body in two parts -> the first paragraph and the rest
+ first_paragraph = soup.find('p')
+ if first_paragraph is not None:
+ first_paragraph = str(first_paragraph)
+ soup.find('p').decompose()
+
+ post.first_paragraph = first_paragraph
post.body = str(soup)