From 03f4080bbe5cdd731d6df83960ec491bb70973cf Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Wed, 10 Apr 2019 17:31:52 -0500 Subject: [PATCH] Couple small improvement in templates and models + Updated README.md + Moved links property to the Location Model for every location type + Updated templates + Added footer --- README.md | 2 +- models.py | 44 +++++++++-------------- static/GeoffreyApp/css/geoffrey.css | 16 +++++++++ templates/GeoffreyApp/base.html | 10 ++++++ templates/GeoffreyApp/home.html | 4 +-- templates/GeoffreyApp/location.html | 2 +- templates/GeoffreyApp/location_table.html | 1 - templates/GeoffreyApp/player.html | 1 + 8 files changed, 46 insertions(+), 34 deletions(-) create mode 100644 static/GeoffreyApp/css/geoffrey.css diff --git a/README.md b/README.md index 5751374..7649bcf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Geoffrey: A Discord Bot for Minecraft Servers +# Geoffrey: A Location Database for Minecraft Servers Geoffrey was created to be an information source for base and shop locations on Minecraft severs. The bot mainly tracks base, shop, and tunnel locations. This allows for users to quickly find each other's builds and find shops selling goods. diff --git a/models.py b/models.py index c80e3e3..17e6f34 100644 --- a/models.py +++ b/models.py @@ -83,6 +83,8 @@ class Player(models.Model): class Location(models.Model): + info_page = None + """Model of a Location""" DIMENSIONS = ( @@ -194,8 +196,10 @@ class Location(models.Model): """ child = self.loc_child_obj - if child != self: - return self.loc_child_obj.link + if child is not self: + return reverse(child.info_page, kwargs={"id": child.id}) + else: + return reverse(self.info_page, kwargs={"id": self.id}) @property def loc_child_obj(self): @@ -233,30 +237,22 @@ class Location(models.Model): class Shop(Location): + info_page = "GeoffreyShopInfo" + def __str__(self): return "Shop: %s" % self.name - @property - def link(self): - """ - Link to the shop's page - """ - return reverse("GeoffreyShopInfo", kwargs={"id": self.id}) - class Base(Location): + info_page = "GeoffreyBaseInfo" + def __str__(self): return "Base: %s" % self.name - @property - def link(self): - """ - Link to the base's page - """ - return reverse("GeoffreyBaseInfo", kwargs={"id": self.id}) - class Town(Location): + info_page = "GeoffreyTownInfo" + residents = models.ManyToManyField(Player) """ Players who are members of the town @@ -301,21 +297,13 @@ class Town(Location): return json - @property - def link(self): - """ - Link to the town's page - """ - return reverse("GeoffreyTownInfo", kwargs={"id": self.id}) + +class Market(Location): + info_page = "GeoffreyMarketInfo" class PublicFarm(Location): - @property - def link(self): - """ - Link to the Farms's page - """ - return reverse("GeoffreyPublicFarmInfo", kwargs={"id": self.id}) + info_page = "GeoffreyPublicFarmInfo" class Resource(models.Model): diff --git a/static/GeoffreyApp/css/geoffrey.css b/static/GeoffreyApp/css/geoffrey.css new file mode 100644 index 0000000..419bbc7 --- /dev/null +++ b/static/GeoffreyApp/css/geoffrey.css @@ -0,0 +1,16 @@ +html { + position: relative; + min-height: 100%; +} + +body { + margin-bottom: 60px; +} + +.footer { + position: absolute; + bottom: 0; + width: 100%; + height: 30px; + line-height: 30px; +} diff --git a/templates/GeoffreyApp/base.html b/templates/GeoffreyApp/base.html index 4d8a9ca..123875f 100644 --- a/templates/GeoffreyApp/base.html +++ b/templates/GeoffreyApp/base.html @@ -26,6 +26,8 @@ + + @@ -54,5 +56,13 @@

{% block header %}{% endblock %}

{% block content %}{% endblock %} + + diff --git a/templates/GeoffreyApp/home.html b/templates/GeoffreyApp/home.html index 0a8ed24..becfdba 100644 --- a/templates/GeoffreyApp/home.html +++ b/templates/GeoffreyApp/home.html @@ -27,6 +27,4 @@ - - -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/GeoffreyApp/location.html b/templates/GeoffreyApp/location.html index 07e46eb..87df13a 100644 --- a/templates/GeoffreyApp/location.html +++ b/templates/GeoffreyApp/location.html @@ -17,7 +17,7 @@

{% endif %} -

Location: {{ loc.location }}

+

Location: {{ loc.position }}


{% block info %}{% endblock %}