diff --git a/evennia/help/models.py b/evennia/help/models.py
index d3323266c6..76391699e3 100644
--- a/evennia/help/models.py
+++ b/evennia/help/models.py
@@ -57,10 +57,6 @@ class HelpEntry(SharedMemoryModel):
"help key", max_length=255, unique=True, help_text="key to search for"
)
- @lazy_property
- def key(self):
- return self.db_key
-
# help category
db_help_category = models.CharField(
"help category",
@@ -69,10 +65,6 @@ class HelpEntry(SharedMemoryModel):
help_text="organizes help entries in lists",
)
- @lazy_property
- def help_category(self):
- return self.db_help_category
-
# the actual help entry text, in any formatting.
db_entrytext = models.TextField(
"help entry", blank=True, help_text="the main body of help text"
@@ -233,11 +225,10 @@ class HelpEntry(SharedMemoryModel):
"""
try:
- url = reverse(
+ return reverse(
"%s-detail" % slugify(self._meta.verbose_name),
kwargs={"category": slugify(self.db_help_category), "topic": slugify(self.db_key)},
)
- return url
except Exception:
return "#"
diff --git a/evennia/web/templates/website/help_detail.html b/evennia/web/templates/website/help_detail.html
index 9da5ad3a1f..a5ed6045ef 100644
--- a/evennia/web/templates/website/help_detail.html
+++ b/evennia/web/templates/website/help_detail.html
@@ -17,8 +17,8 @@
- Help Index
- - {{ object.help_category|title }}
- - {{ object.key|title }}
+ - {{ object.help_category|title }}
+ - {{ object.web_help_key|title }}
@@ -62,7 +62,7 @@
{% endif %}
-
+
{% for topic in topic_list %}
diff --git a/evennia/web/website/views/help.py b/evennia/web/website/views/help.py
index 04a2933675..caa1fd911b 100644
--- a/evennia/web/website/views/help.py
+++ b/evennia/web/website/views/help.py
@@ -33,7 +33,10 @@ def get_help_category(help_entry, slugify_cat=True):
Returns:
help_category (str): The category for the help entry.
"""
- help_category = getattr(help_entry, 'help_category', DEFAULT_HELP_CATEGORY)
+ help_category = getattr(help_entry, 'help_category', None)
+ if not help_category:
+ help_category = getattr(help_entry, 'db_help_category', DEFAULT_HELP_CATEGORY)
+ # if one does not exist, create a category for ease of use with web views html templates
if not hasattr(help_entry, 'web_help_category'):
setattr(help_entry, 'web_help_category', slugify(help_category))
return slugify(help_category) if slugify_cat else help_category
@@ -46,9 +49,16 @@ def get_help_topic(help_entry):
help_entry (HelpEntry, FileHelpEntry or Command): Help entry instance.
Returns:
- topic (str): The topic of the help entry. Default is 'unknown_topic'.
+ help_topic (str): The topic of the help entry. Default is 'unknown_topic'.
"""
- return getattr(help_entry, 'key', 'unknown_topic')
+ help_topic = getattr(help_entry, 'key', None)
+ # if object has no key, assume it is a db help entry.
+ if not help_topic:
+ help_topic = getattr(help_entry, 'db_key', 'unknown_topic')
+ # if one does not exist, create a key for ease of use with web views html templates
+ if not hasattr(help_entry, 'web_help_key'):
+ setattr(help_entry, 'web_help_key', slugify(help_topic))
+ return help_topic
def can_read_topic(cmd_or_topic, account):