diff --git a/app/models.py b/app/models.py index ab88fc6a..0c9b2f27 100644 --- a/app/models.py +++ b/app/models.py @@ -275,6 +275,7 @@ class Package(db.Model): class Tag(db.Model): id = db.Column(db.Integer, primary_key=True) + name = db.Column(db.String(100), unique=True, nullable=False) title = db.Column(db.String(100), nullable=False) backgroundColor = db.Column(db.String(6), nullable=False) textColor = db.Column(db.String(6), nullable=False) @@ -284,10 +285,9 @@ class Tag(db.Model): self.backgroundColor = backgroundColor self.textColor = textColor - def getName(self): import re regex = re.compile('[^a-z_]') - return regex.sub("", self.title.lower().replace(" ", "_")) + self.name = regex.sub("", self.title.lower().replace(" ", "_")) class PackageRelease(db.Model): id = db.Column(db.Integer, primary_key=True) diff --git a/app/templates/packages/create_edit.html b/app/templates/packages/create_edit.html index 26b4c445..ad8ff6bd 100644 --- a/app/templates/packages/create_edit.html +++ b/app/templates/packages/create_edit.html @@ -14,6 +14,7 @@ {{ render_field(form.shortDesc) }} {{ render_field(form.desc) }} {{ render_field(form.type) }} + {{ render_field(form.tags) }} {{ render_field(form.repo) }} {{ render_field(form.website) }} {{ render_field(form.issueTracker) }} diff --git a/app/templates/packages/list.html b/app/templates/packages/list.html index 666e5af8..cd7f7d9f 100644 --- a/app/templates/packages/list.html +++ b/app/templates/packages/list.html @@ -26,7 +26,7 @@