Skip to content
Snippets Groups Projects
Commit 199a8a0e authored by Ivan Procaccini's avatar Ivan Procaccini
Browse files

Feat: Support creation of new project

parent 9533ce65
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@
<section class="w3-section">
<label>
Description
<textarea class="w3-input w3-border" placeholder="Description of my new project..." required rows="10"></textarea>
<textarea name="description" class="w3-input w3-border" placeholder="Description of my new project..." required rows="10"></textarea>
</label>
</section>
<button type="submit" class="w3-btn w3-teal">Save</button>
......
from datetime import datetime
from flask import render_template, Blueprint, redirect, url_for, flash, request
from flask_login import login_required
from flask import render_template, Blueprint, redirect, url_for, flash, request, g
from flask_login import login_required, current_user
from app import Project, db, messages
......@@ -12,8 +12,14 @@ bp = Blueprint("staff", __name__, url_prefix="/staff")
@login_required
def projects():
if request.method == "POST":
# Save new project
pass
project = Project(
title=request.form["title"],
description=request.form["description"],
proposer=current_user.username,
)
db.session.add(project)
db.session.commit()
return redirect(url_for("staff.projects"))
active_projects: list[Project] = Project.query.filter(
Project.deleted.is_(None)
).all()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment