-
Notifications
You must be signed in to change notification settings - Fork 0
/
your_posts.py
34 lines (23 loc) · 1.08 KB
/
your_posts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import streamlit as st
from firebase_admin import firestore
def app():
db=firestore.client()
try:
st.title('Paylaşan kullanıcı: '+st.session_state['username'] )
result = db.collection('Gönderimler').document(st.session_state['username']).get()
r=result.to_dict()
content = r['Content']
def delete_post(k):
c=int(k)
h=content[c]
try:
db.collection('Posts').document(st.session_state['username']).update({"Content": firestore.ArrayRemove([h])})
st.warning('Gönderi silindi')
except:
st.write('Something went wrong..')
for c in range(len(content)-1,-1,-1):
st.text_area(label='',value=content[c])
st.button('Gönderi Sil', on_click=delete_post, args=([c] ), key=c)
except:
if st.session_state.username=='':
st.warning('Lütfen paylaşımlarınız görebilmek için önce giriş yapınız!!')