Made a 'create page' form that just redirects you to the edit page

This commit is contained in:
2025-10-13 18:47:43 +01:00
parent 25e0ec2c60
commit 5d51b7ecfa
4 changed files with 27 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
host='0.0.0.0'
port=8080
domain='example.com'
debug=True
database={'host': 'localhost', 'username': 'root', 'database': 'deadwiki', 'password': '123'}
allow_signup=False

View File

@@ -30,6 +30,14 @@ def wiki_page(page):
else:
return 'Page does not exist'
@app.route('/create_page')
def create_page():
return render_template('forms/create_page.html')
@app.route('/submit_create_page', methods=['POST'])
def submit_create_page():
page_name = request.form['page_name']
return redirect(f'/edit/{page_name}', 302)
@app.route('/edit/<page>')
def edit_page(page):
if os.path.isfile(f'./wiki-pages/{page}.md'):

View File

@@ -0,0 +1,15 @@
<body>
<header>
{% include 'partials/site-wide-header.html' %}
</header>
<form action='/submit_create_page' method='post'>
<label>Page Name:</label>
<input type='text' name='page_name'>
<input type='submit' value='submit'>
</form
<footer>
{% include 'partials/site-wide-footer.html' %}
</footer>
</body>
</html>

View File

@@ -1,2 +1,4 @@
<a href='/'>Home Page</a>
/
<a href='/create_page'>Create New Page</a>
<hr/>