Merge pull request 'Sort item names in `info` alphabetically' (#28) from issue/info_item_sort into main

Reviewed-on: https://git.etztech.xyz/ZeroHD/Geoffrey/pulls/28
doc_update
Joey Hines 2020-10-10 18:46:36 +02:00
commit a7b2413136
2 changed files with 3 additions and 4 deletions

View File

@ -517,11 +517,11 @@ def info(location_name):
if type(loc) == Shop:
loc_json["items"] = []
for item in loc.shop_selling.all():
for item in loc.shop_selling.order_by("item_name").all():
loc_json["items"].append(item.json)
elif type(loc) == PublicFarm:
loc_json["resources"] = []
for resource in loc.resource.all():
for resource in loc.resource.order_by("resource_name").all():
loc_json["resources"].append(resource.json)
return loc_json

View File

@ -113,7 +113,7 @@ class Player(models.Model):
return {"name": self.name,
"mc_uuid": self.mc_uuid,
"discord_uuid": self.discord_uuid,
"primary_location": self.primary_location.json
"primary_location": self.primary_location.id
}
@property
@ -226,7 +226,6 @@ class Location(models.Model):
"location": self.position,
"tunnel": None if self.tunnel is None else self.tunnel.tunnel_str,
"link": self.link,
"primary_location": self.player.primary_location
}
@property