File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 66
77# @rx.page(route='/about')
88def blog_post_detail_page () -> rx .Component :
9+ can_edit = True
10+ edit_link = rx .link ("Edit" , href = f"/blog/{ state .BlogPostState .blog_post_id } /edit" )
11+ edit_link_el = rx .cond (
12+ can_edit ,
13+ edit_link ,
14+ rx .fragment ("" )
15+ )
916 my_child = rx .vstack (
10- rx .heading (state .BlogPostState .post .title , size = "9" ),
17+ rx .hstack (
18+ rx .heading (state .BlogPostState .post .title , size = "9" ),
19+ edit_link_el ,
20+ align = 'end'
21+ ),
1122 rx .text (
1223 state .BlogPostState .post .content ,
24+ white_space = 'pre-wrap'
1325 ),
1426 spacing = "5" ,
1527 align = "center" ,
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ def get_post_detail(self):
2525 )
2626 ).one_or_none ()
2727 self .post = result
28+ if result is None :
29+ self .post_content = ""
30+ return
2831 self .post_content = self .post .content
2932 # return
3033
You can’t perform that action at this time.
0 commit comments