diff options
| author | Alexis Metaireau <alexis@notmyidea.org> | 2011-07-31 00:53:12 +0200 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2011-07-31 00:53:12 +0200 |
| commit | 3417a5a7d48ade7744586a711127d2302f58109a (patch) | |
| tree | c9ab5bfc50596f582bd51fd414ff73bab1c66c4c /budget/web.py | |
| parent | 2df6e11f05eff9bd855079097aa865f52689d7ca (diff) | |
| download | ihatemoney-mirror-3417a5a7d48ade7744586a711127d2302f58109a.zip ihatemoney-mirror-3417a5a7d48ade7744586a711127d2302f58109a.tar.gz ihatemoney-mirror-3417a5a7d48ade7744586a711127d2302f58109a.tar.bz2 | |
List the projects in session into the home page.
This allows easier access when people don't remembre the name / url of their projects.
Diffstat (limited to 'budget/web.py')
| -rw-r--r-- | budget/web.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/budget/web.py b/budget/web.py index f313266..1afb8c1 100644 --- a/budget/web.py +++ b/budget/web.py @@ -15,7 +15,8 @@ mail = Mail() def home(): project_form = ProjectForm() auth_form = AuthenticationForm() - return render_template("home.html", project_form=project_form, auth_form=auth_form) + return render_template("home.html", project_form=project_form, + auth_form=auth_form, session=session) @app.route("/authenticate", methods=["GET", "POST"]) def authenticate(redirect_url=None): @@ -40,7 +41,10 @@ def authenticate(redirect_url=None): form.errors['password'] = ["The password is not the right one"] else: # maintain a list of visited projects - session["projects"].append(project_id) + if "projects" not in session: + session["projects"] = [] + # add the project on the top of the list + session["projects"].insert(0, (project_id, project.name)) session[project_id] = form.password.data session.update() return redirect(redirect_url) |
