Add community hub to list game content

This commit is contained in:
rubenwardy
2022-02-01 21:22:28 +00:00
parent d529634b7f
commit 7c93db95a3
6 changed files with 140 additions and 1 deletions

View File

@@ -475,6 +475,14 @@ class Package(db.Model):
for e in PackagePropertyKey:
setattr(self, e.name, getattr(package, e.name))
@classmethod
def get_by_key(cls, key):
parts = key.split("/")
if len(parts) != 2:
return None
return Package.query.filter(Package.name == parts[1], Package.author.has(username=parts[0])).first()
def getId(self):
return "{}/{}".format(self.author.username, self.name)