itachi-ai commited on
Commit
b73d72d
·
verified ·
1 Parent(s): 29b2b56

allow html

Browse files
Files changed (1) hide show
  1. home.py +27 -27
home.py CHANGED
@@ -1,27 +1,27 @@
1
- import os
2
- import streamlit as st
3
- from mongodb import get_post_titles, get_post_by_id
4
-
5
- post_titles = list(get_post_titles("public"))
6
-
7
- if post_titles:
8
- st.sidebar.subheader("Select a post to view:")
9
-
10
- # Display titles as clickable buttons in the sidebar
11
- selected_post = None
12
- for post in post_titles:
13
- if st.sidebar.button(post["title"]):
14
- # Get the content of the clicked post
15
- post_id = post["_id"]
16
- selected_post = get_post_by_id(post_id)
17
-
18
- # Display the content of the selected post
19
- st.subheader(selected_post["title"])
20
- st.divider()
21
- st.markdown(selected_post["content"]) # Render the content as Markdown
22
-
23
- # Provide options to update or delete the selected post
24
- else:
25
- st.sidebar.write("No posts available.")
26
-
27
-
 
1
+ import os
2
+ import streamlit as st
3
+ from mongodb import get_post_titles, get_post_by_id
4
+
5
+ post_titles = list(get_post_titles("public"))
6
+
7
+ if post_titles:
8
+ st.sidebar.subheader("Select a post to view:")
9
+
10
+ # Display titles as clickable buttons in the sidebar
11
+ selected_post = None
12
+ for post in post_titles:
13
+ if st.sidebar.button(post["title"]):
14
+ # Get the content of the clicked post
15
+ post_id = post["_id"]
16
+ selected_post = get_post_by_id(post_id)
17
+
18
+ # Display the content of the selected post
19
+ st.subheader(selected_post["title"])
20
+ st.divider()
21
+ st.markdown(selected_post["content"], unsafe_allow_html = True) # Render the content as Markdown
22
+
23
+ # Provide options to update or delete the selected post
24
+ else:
25
+ st.sidebar.write("No posts available.")
26
+
27
+