From 8d2bb12ad46b5dc789dc0182d867cae3159f755f Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 24 May 2018 01:09:08 +0100 Subject: [PATCH] Add duplicate package check --- app/views/packages.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/packages.py b/app/views/packages.py index e0faa58..2c710b0 100644 --- a/app/views/packages.py +++ b/app/views/packages.py @@ -168,6 +168,11 @@ def create_edit_package_page(author=None, name=None): if request.method == "POST" and form.validate(): wasNew = False if not package: + package = getPackageByInfo(author.username, form["name"].data) + if package is not None: + flash("Package already exists!", "error") + return redirect(url_for("create_edit_package_page")) + package = Package() package.author = author wasNew = True