Done with the samples, and can be released as first version!

This commit is contained in:
2025-01-13 14:27:20 +01:00
parent 425e583bbe
commit 6a16200a51
27 changed files with 628 additions and 93 deletions

30
main.py
View File

@ -43,7 +43,35 @@ def uni():
@app.route('/projects')
def projects():
return render_template('projects/projects.html')
posts = []
with open("posts.json", "r") as f:
posts = json.load(f)
posts.reverse()
return render_template('projects/projects.html', post_data=posts)
@app.route('/projects/search', methods=['GET', 'POST'])
def search():
searched = request.args.get('searched')
searched = str(searched).lower()
posts = []
with open("posts.json", "r") as f:
posts = json.load(f)
posts.reverse()
if searched == "":
return render_template('projects/projects.html', post_data=posts)
found = []
for i in posts:
if searched in [j.lower() for j in i['topics']] and i not in found:
found.append(i)
if searched in i['title'].lower() and i not in found:
found.append(i)
if searched in i['content'].lower() and i not in found:
found.append(i)
if searched in i['date'] and i not in found:
found.append(i)
return render_template('projects/projects.html', post_data=found)
@app.route('/git')
def git():