summaryrefslogtreecommitdiff
path: root/pgweb/docs/models.py
diff options
context:
space:
mode:
authorJonathan S. Katz2020-02-11 19:41:46 +0000
committerJonathan S. Katz2020-04-24 23:33:16 +0000
commite2120f0a80697d13dc6d951f363d01feb60c9b9d (patch)
tree87e27ccbfb5008b61b9a9b3f94a2e9bcf5b7121b /pgweb/docs/models.py
parent2239cc1f2c1f8697f275e8ab8d868ac08f3d6788 (diff)
Introduce documentation redirects for doc pages that are renamed
The web documentation used to suffer from a problem that if a documentation page were renamed in a newer version, any references pointing to said documentation would be lost. For example, the feature known as "Default Roles" was renamed to "Privileged Roles" but caused a change in the URL. This patch introduces the ability to create a "DocPageRedirect" by specifying the previous name of the documentation page (e.g. "default-roles.html") and the new name (e.g. "privileged-roles.html") such that the continuity is preserved between versions.
Diffstat (limited to 'pgweb/docs/models.py')
-rw-r--r--pgweb/docs/models.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/pgweb/docs/models.py b/pgweb/docs/models.py
index 87afe1ca..a4558a68 100644
--- a/pgweb/docs/models.py
+++ b/pgweb/docs/models.py
@@ -33,3 +33,14 @@ class DocPageAlias(models.Model):
class Meta:
db_table = 'docsalias'
verbose_name_plural = 'Doc page aliases'
+
+
+class DocPageRedirect(models.Model):
+ """DocPageRedirect offers the ability to redirect from a page that has been
+ completely removed from the PostgreSQL documentation
+ """
+ redirect_from = models.CharField(max_length=64, null=False, blank=False, unique=True, help_text='Page to redirect from, e.g. "old_page.html"')
+ redirect_to = models.CharField(max_length=64, null=False, blank=False, unique=True, help_text='Page to redirect from, e.g. "new_page.html"')
+
+ class Meta:
+ verbose_name_plural = "Doc page redirects"