diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-07-28 18:12:22 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-07-28 18:12:22 +0100 |
commit | a3e82ad42f7707af43db477596fb6fe5fc5a6b53 (patch) | |
tree | b87e2041ea76d81ff567943bffeadac4f9dad192 /app/models.py | |
parent | 404200b8f0809a4aeb2b02b91db3d3682a59f692 (diff) | |
download | cheatdb-a3e82ad42f7707af43db477596fb6fe5fc5a6b53.tar.xz |
Add support for multiple types in packages list
Diffstat (limited to 'app/models.py')
-rw-r--r-- | app/models.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models.py b/app/models.py index f002abc..8f71146 100644 --- a/app/models.py +++ b/app/models.py @@ -212,6 +212,13 @@ class PackageType(enum.Enum): return self.name @classmethod + def get(cls, name): + try: + return PackageType[name.upper()] + except KeyError: + return None + + @classmethod def choices(cls): return [(choice, choice.value) for choice in cls] |