Add Markdown support to feature matrix descriptions
authorJonathan S. Katz <jonathan.katz@excoventures.com>
Sun, 30 Aug 2020 19:46:50 +0000 (15:46 -0400)
committerJonathan S. Katz <jonathan.katz@excoventures.com>
Sun, 30 Aug 2020 19:46:50 +0000 (15:46 -0400)
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
pgweb/featurematrix/models.py
templates/featurematrix/featuredetail.html

index a68e86ea7defe2e2a65fd4634e1c017745d8affc..ec3ba8148a3677fdc50d6f47bd2b14d53697cbd1 100644 (file)
@@ -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, '?')])),
index b2ae0063bdb6d201b3699a8e5623156d535cadd7..982c8c582b0835577a7773b0f1a764d00a49ac1e 100644 (file)
@@ -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
index e3716ed73edc64de353d150f2b18c347f0b8b7cc..8472277b47a133f8ff875fbda386a5c75c10c33f 100644 (file)
@@ -1,9 +1,10 @@
 {%extends "base/page.html"%}
+{% load markup %}
 {%block title%}Feature Description{%endblock%}
 {%block contents%}
 <h1>Feature Description</h1>
 <h2>{{feature.featurename}}</h2>
 <p>
-{{feature.featuredescription}}
+{{feature.featuredescription|markdown:"safe"}}
 </p>
 {%endblock%}