diff --git a/models.py b/models.py index 0cd7da1..8596c8b 100644 --- a/models.py +++ b/models.py @@ -92,7 +92,7 @@ class Location(models.Model): @property def location(self): - return "(x={}, z={}".format(self.x_coord, self.z_coord) + return "(x={}, z={})".format(self.x_coord, self.z_coord) @property def json(self): @@ -104,6 +104,26 @@ class Location(models.Model): "owner": self.owner.json } + @property + def loc_type(self): + if hasattr(self, "shop"): + return "shop" + elif hasattr(self, "base"): + return "base" + else: + return "location" + + @property + def dynmap_url(self): + base_url = getattr(settings, "GEOFFREY_DYNMAP_BASE_URL") + world_name = getattr(settings, "GEOFFREY_DYNMAP_WORLD_NAME") + if base_url is not None: + url = base_url + "/?worldname={}&mapname=surface&zoom=4&x={}&y=65&z={}".format(world_name, self.x_coord, + self.z_coord) + return url + else: + return None + def __str__(self): return self.name @@ -161,7 +181,6 @@ class ItemListing(models.Model): "shop": self.shop.json, } - def __str__(self): return "Item: %d %s for %d" % (self.amount, self.item_name, self.amount) diff --git a/templates/GeoffreyApp/base.html b/templates/GeoffreyApp/base.html index 9f44fd4..4d8a9ca 100644 --- a/templates/GeoffreyApp/base.html +++ b/templates/GeoffreyApp/base.html @@ -5,7 +5,7 @@ - {% block title %}GeoffreyApp{% endblock %} + {% block title %}Geoffrey{% endblock %} {% load static %} @@ -29,7 +29,7 @@ -