Commit 991d8644 authored by Alex's avatar Alex
Browse files

fix incorrect redirect url

parent 5bb21f79
from flask import Flask, send_from_directory, url_for
from flask import Flask, send_from_directory
from database.db import db
from config.config import APP_NAME, ENV, get_app_config, get_static_url
......
from flask import Blueprint, render_template, request, redirect, url_for
from flask import Blueprint, render_template, request, redirect
from config import url_for2
from database.db import db
from models.user import Entity
......@@ -30,6 +31,9 @@ def entities():
username = request.form.get('username')
email = request.form.get('email')
db.session.add(Entity(username=username, email=email))
db.session.commit()
return redirect('/entities')
try:
db.session.add(Entity(username=username, email=email))
db.session.commit()
return redirect(url_for2('.entities'))
except:
return "Could not add entity, username and/or email are already in use."
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment