diff options
| author | Daniel Atwood <59884378+indatwood@users.noreply.github.com> | 2020-05-24 11:45:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-24 11:45:34 +0200 |
| commit | 0fd2958865319983b0c7efed66f702aefdd6184b (patch) | |
| tree | 9d9d9dac99dfd4a7c2cd3624d98f9acb9082d676 /ihatemoney/web.py | |
| parent | 82393a110aa1d240ea8137a96efb66bad65581ac (diff) | |
| download | ihatemoney-mirror-0fd2958865319983b0c7efed66f702aefdd6184b.zip ihatemoney-mirror-0fd2958865319983b0c7efed66f702aefdd6184b.tar.gz ihatemoney-mirror-0fd2958865319983b0c7efed66f702aefdd6184b.tar.bz2 | |
Populate the demo project with defaults. (#616)
Diffstat (limited to 'ihatemoney/web.py')
| -rw-r--r-- | ihatemoney/web.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/ihatemoney/web.py b/ihatemoney/web.py index 6575720..442779f 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -559,11 +559,11 @@ def exit(): @main.route("/demo") def demo(): """ - Authenticate the user for the demonstration project and redirect him to + Authenticate the user for the demonstration project and redirects to the bills list for this project. Create a demo project if it doesn't exists yet (or has been deleted) - If the demo project is deactivated, one is redirected to the create project form + If the demo project is deactivated, redirects to the create project form. """ is_demo_project_activated = current_app.config["ACTIVATE_DEMO_PROJECT"] project = Project.query.get("demo") @@ -571,15 +571,7 @@ def demo(): if not project and not is_demo_project_activated: raise Redirect303(url_for(".create_project", project_id="demo")) if not project and is_demo_project_activated: - project = Project( - id="demo", - name="demonstration", - password=generate_password_hash("demo"), - contact_email="demo@notmyidea.org", - default_currency="EUR", - ) - db.session.add(project) - db.session.commit() + project = Project.create_demo_project() session[project.id] = True return redirect(url_for(".list_bills", project_id=project.id)) |
