23 lines
453 B
Python
23 lines
453 B
Python
|
import re
|
||
|
|
||
|
from sqlalchemy import desc
|
||
|
|
||
|
from models import Notifikasi, Session
|
||
|
|
||
|
session = Session()
|
||
|
|
||
|
|
||
|
def main_test():
|
||
|
cek_data = (
|
||
|
session.query(Notifikasi).order_by(desc(Notifikasi.created_at)).limit(10).all()
|
||
|
)
|
||
|
|
||
|
for notif in cek_data:
|
||
|
html_p = re.sub(r"<p.*?>", "\n\n", str(notif.status))
|
||
|
raw = html_p.replace("<p>", "\n")
|
||
|
html_content = re.sub(r"<.*?>", "", raw)
|
||
|
print(html_content)
|
||
|
|
||
|
|
||
|
main_test()
|