Redirect /workspaces/<id> to canonical URL
This commit is contained in:
parent
0469e061da
commit
e2e6e6da4d
@ -1,16 +1,26 @@
|
||||
from flask import Blueprint, render_template, request as http_request, g, redirect, url_for
|
||||
from flask import (
|
||||
Blueprint,
|
||||
render_template,
|
||||
request as http_request,
|
||||
g,
|
||||
redirect,
|
||||
url_for,
|
||||
)
|
||||
|
||||
from atst.domain.workspaces import Workspaces, Members, Projects, Environments
|
||||
from atst.forms.new_project import NewProjectForm
|
||||
|
||||
bp = Blueprint("workspaces", __name__)
|
||||
|
||||
|
||||
@bp.context_processor
|
||||
def workspace():
|
||||
workspace = None
|
||||
if "workspace_id" in http_request.view_args:
|
||||
workspace = Workspaces.get(g.current_user, http_request.view_args["workspace_id"])
|
||||
return { "workspace": workspace }
|
||||
workspace = Workspaces.get(
|
||||
g.current_user, http_request.view_args["workspace_id"]
|
||||
)
|
||||
return {"workspace": workspace}
|
||||
|
||||
|
||||
@bp.route("/workspaces")
|
||||
@ -25,6 +35,11 @@ def workspace_projects(workspace_id):
|
||||
return render_template("workspace_projects.html", workspace=workspace)
|
||||
|
||||
|
||||
@bp.route("/workspaces/<workspace_id>")
|
||||
def show_workspace(workspace_id):
|
||||
return redirect(url_for("workspaces.workspace_projects", workspace_id=workspace_id))
|
||||
|
||||
|
||||
@bp.route("/workspaces/<workspace_id>/members")
|
||||
def workspace_members(workspace_id):
|
||||
workspace = Workspaces.get(g.current_user, workspace_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user