diff --git a/app/templates/pages/staff/projects.html b/app/templates/pages/staff/projects.html index 6a95bcbecc06a2da4bb744c8a2b308baf7f484fc..cbbd9acb21a5574b8dda63a9c012920f0def8265 100644 --- a/app/templates/pages/staff/projects.html +++ b/app/templates/pages/staff/projects.html @@ -18,8 +18,10 @@ <a href="{{ url_for("staff.view_project", project_id=project.id) }}" class="w3-button w3-hover-teal">View</a> {% endif %} + {% if allow_edit %} <a href="{{ url_for("staff.delete_project", project_id=project.id) }}" class="w3-button w3-hover-red">Delete</a> + {% endif %} </div> </li> {% endfor %} diff --git a/app/views/staff.py b/app/views/staff.py index fa4c80eaa788de5979c33ddcba3be3d0ea382b8b..71845255d6ab606fe2be831ec03ebdb464f5ea4e 100644 --- a/app/views/staff.py +++ b/app/views/staff.py @@ -133,6 +133,8 @@ def delete_project(project_id): can_delete = False elif project.category not in category_codes: can_delete = False + elif project.proposer != current_user.username: + can_delete = False if can_delete: project.deleted = datetime.utcnow() db.session.commit()