Item type check methods created within Item class

This commit is contained in:
ro 2019-06-09 02:56:22 +02:00 committed by GitHub
parent eaf8f4ccbc
commit 651896c20e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,34 @@ class Item(db.Model):
tour = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
release_date = db.Column(db.Date, nullable=False, server_default=db.text("now()"))
def is_color(self):
return self.type == 1
def is_head(self):
return self.type == 2
def is_face(self):
return self.type == 3
def is_neck(self):
return self.type == 4
def is_body(self):
return self.type == 5
def is_hand(self):
return self.type == 6
def is_feet(self):
return self.type == 7
def is_flag(self):
return self.type == 8
def is_photo(self):
return self.type == 9
class PenguinItem(db.Model):
__tablename__ = 'penguin_item'