Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit acb3752

Browse files
authored
Support Markdown in dashboard descriptions
Thanks, @toolness - closes #115
1 parent 4a9dcfe commit acb3752

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.2.3 on 2021-05-25 10:58
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('django_sql_dashboard', '0003_update_metadata'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='dashboard',
15+
name='description',
16+
field=models.TextField(blank=True, help_text='Optional description (Markdown allowed)'),
17+
),
18+
]

django_sql_dashboard/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
class Dashboard(models.Model):
88
slug = models.SlugField(unique=True)
99
title = models.CharField(blank=True, max_length=128)
10-
description = models.TextField(blank=True)
10+
description = models.TextField(
11+
blank=True, help_text="Optional description (Markdown allowed)"
12+
)
1113
owned_by = models.ForeignKey(
1214
settings.AUTH_USER_MODEL,
1315
null=True,

django_sql_dashboard/templates/django_sql_dashboard/saved_dashboard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{% if user_can_execute_sql %}<p><a href="{% url 'django_sql_dashboard-index' %}">Dashboard index</a></p>{% endif %}
1515
<h1>{% if dashboard.title %}{{ dashboard.title }}{% else %}{{ dashboard.slug }}{% endif %}</h1>
1616
{% if dashboard.description %}
17-
<p>{{ dashboard.description }}</p>
17+
{{ dashboard.description|sql_dashboard_markdown }}
1818
{% endif %}
1919

2020
<p style="color: #666; font-size: 0.9em; margin-top: -1em">

django_sql_dashboard/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Meta:
4747
widgets = {
4848
"description": Textarea(
4949
attrs={
50-
"placeholder": "Optional description, shown at the top of the dashboard page"
50+
"placeholder": "Optional description, shown at the top of the dashboard page (Markdown allowed)"
5151
}
5252
)
5353
}

0 commit comments

Comments
 (0)