Make inventory items more dynamic
This commit is contained in:
@@ -221,7 +221,7 @@ def clean(value):
|
||||
|
||||
|
||||
def item_payload(data):
|
||||
return {
|
||||
payload = {
|
||||
"name": clean(data.get("name")),
|
||||
"item_type": clean(data.get("item_type")),
|
||||
"brand": clean(data.get("brand")),
|
||||
@@ -240,6 +240,15 @@ def item_payload(data):
|
||||
"storage": clean(data.get("storage")),
|
||||
"media_format": clean(data.get("media_format")),
|
||||
}
|
||||
if payload["item_type"] != "Computer":
|
||||
payload["cpu"] = ""
|
||||
payload["ram"] = ""
|
||||
if payload["item_type"] not in {"Computer", "Graphics"}:
|
||||
payload["gpu"] = ""
|
||||
payload["storage"] = ""
|
||||
if payload["item_type"] not in {"CD", "Long play disk", "Audio"}:
|
||||
payload["media_format"] = ""
|
||||
return payload
|
||||
|
||||
|
||||
def serialize(row, connection):
|
||||
|
||||
Reference in New Issue
Block a user