From 0a101dc3a43b6856dba1bb3bd55a9b7d67665fbd Mon Sep 17 00:00:00 2001 From: "Jonathan S. Katz" Date: Sun, 30 Aug 2020 15:46:50 -0400 Subject: [PATCH] Add Markdown support to feature matrix descriptions This will make it possible to allow for links in longer descriptions for particular features. This also adds some help text describing how the feature matrix details field works, as I remember I was originally caught by surprise that one could provide a direct link to something. --- pgweb/featurematrix/migrations/0001_initial.py | 2 +- pgweb/featurematrix/models.py | 2 +- templates/featurematrix/featuredetail.html | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pgweb/featurematrix/migrations/0001_initial.py b/pgweb/featurematrix/migrations/0001_initial.py index a68e86ea..ec3ba814 100644 --- a/pgweb/featurematrix/migrations/0001_initial.py +++ b/pgweb/featurematrix/migrations/0001_initial.py @@ -15,7 +15,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('featurename', models.CharField(max_length=100)), - ('featuredescription', models.TextField(blank=True)), + ('featuredescription', models.TextField(blank=True, help_text="""Supports Markdown. A single, plain URL will link directly to that URL.""")), ('v74', models.IntegerField(default=0, verbose_name='7.4', choices=[(0, 'No'), (1, 'Yes'), (2, 'Obsolete'), (3, '?')])), ('v80', models.IntegerField(default=0, verbose_name='8.0', choices=[(0, 'No'), (1, 'Yes'), (2, 'Obsolete'), (3, '?')])), ('v81', models.IntegerField(default=0, verbose_name='8.1', choices=[(0, 'No'), (1, 'Yes'), (2, 'Obsolete'), (3, '?')])), diff --git a/pgweb/featurematrix/models.py b/pgweb/featurematrix/models.py index b2ae0063..982c8c58 100644 --- a/pgweb/featurematrix/models.py +++ b/pgweb/featurematrix/models.py @@ -27,7 +27,7 @@ class FeatureGroup(models.Model): class Feature(models.Model): group = models.ForeignKey(FeatureGroup, null=False, blank=False, on_delete=models.CASCADE) featurename = models.CharField(max_length=100, null=False, blank=False) - featuredescription = models.TextField(null=False, blank=True) + featuredescription = models.TextField(null=False, blank=True, help_text="""Supports Markdown. A plain URL will link directly to that URL.""") # WARNING! All fields that start with "v" will be considered versions! v74 = models.IntegerField(verbose_name="7.4", null=False, blank=False, default=0, choices=choices) v74.visible_default = False diff --git a/templates/featurematrix/featuredetail.html b/templates/featurematrix/featuredetail.html index e3716ed7..8472277b 100644 --- a/templates/featurematrix/featuredetail.html +++ b/templates/featurematrix/featuredetail.html @@ -1,9 +1,10 @@ {%extends "base/page.html"%} +{% load markup %} {%block title%}Feature Description{%endblock%} {%block contents%}

Feature Description

{{feature.featurename}}

-{{feature.featuredescription}} +{{feature.featuredescription|markdown:"safe"}}

{%endblock%} -- 2.39.5