aboutsummaryrefslogtreecommitdiff
path: root/app/models.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-03-26 12:42:35 +0100
committerrubenwardy <rw@rubenwardy.com>2018-03-26 12:42:40 +0100
commit536da2add2062a9bf76029c7409319d717e6ed6a (patch)
tree7a57aa9f59ccc662e758043413a3c79008d3a399 /app/models.py
parent39ef7128177c6e16434201ce2e8e3513a8d82cb7 (diff)
downloadcheatdb-536da2add2062a9bf76029c7409319d717e6ed6a.tar.xz
Add tag selecting in edit package
Fixes #35
Diffstat (limited to 'app/models.py')
-rw-r--r--app/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models.py b/app/models.py
index ab88fc6..0c9b2f2 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)