File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
django_sql_dashboard/templates/django_sql_dashboard/widgets Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 2828 {% for row in result.row_lists %}
2929 < tr >
3030 {% for item in row %}
31- < td > {% if item is None %}< span class ="null "> - null -</ span > {% else %}{{ item }}{% endif %}</ td >
31+ < td > {% if item is None %}< span class ="null "> - null -</ span > {% else %}{{ item|urlize }}{% endif %}</ td >
3232 {% endfor %}
3333 </ tr >
3434 {% endfor %}
Original file line number Diff line number Diff line change @@ -30,6 +30,37 @@ def test_default_widget(admin_client, dashboard_db):
3030 )
3131
3232
33+ def test_basic_table_with_some_links (admin_client , dashboard_db ):
34+ response = admin_client .post (
35+ "/dashboard/" ,
36+ {
37+ "sql" : """
38+ SELECT
39+ 'https://www.google.com/' as google,
40+ 'http://www.yahoo.com/' as yahoo,
41+ 'www.bing.com/' as bing,
42+ 123 as number,
43+ 'foop' as string,
44+ null as this_is_null
45+ """
46+ },
47+ follow = True ,
48+ )
49+ html = response .content .decode ("utf-8" )
50+ soup = BeautifulSoup (html , "html5lib" )
51+ trs = soup .select ("table tbody tr" )
52+ row = trs [0 ]
53+ tds_html = [str (td ) for td in row .select ("td" )]
54+ assert tds_html == [
55+ '<td><a href="https://www.google.com/" rel="nofollow">https://www.google.com/</a></td>' ,
56+ '<td><a href="http://www.yahoo.com/" rel="nofollow">http://www.yahoo.com/</a></td>' ,
57+ '<td><a href="http://www.bing.com/" rel="nofollow">www.bing.com/</a></td>' ,
58+ "<td>123</td>" ,
59+ "<td>foop</td>" ,
60+ '<td><span class="null">- null -</span></td>' ,
61+ ]
62+
63+
3364def test_default_widget_column_count_links (admin_client , dashboard_db ):
3465 response = admin_client .post (
3566 "/dashboard/" ,
You can’t perform that action at this time.
0 commit comments