-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
28 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
from django import template | ||
from django.db.models.query import QuerySet | ||
from django.utils.html import escape | ||
from django.utils.safestring import mark_safe | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter | ||
def format_change_data_field_value(field_value): | ||
if isinstance(field_value, QuerySet): | ||
return list(field_value) | ||
if isinstance(field_value, str): | ||
return field_value | ||
try: | ||
output = "<ul>" | ||
for value in iter(field_value): | ||
output += "<li>" + escape(value) + "</li>" | ||
output += "</ul>" | ||
return mark_safe(output) | ||
except: | ||
return field_value | ||
|
||
return field_value | ||
# if isinstance(field_value, QuerySet): | ||
# return list(field_value) | ||
|
||
# return field_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[pytest] | ||
DJANGO_SETTINGS_MODULE=tests.test_project.settings.test | ||
addopts = --doctest-modules -ra -l --tb=short --show-capture=log --color=yes | ||
addopts = --doctest-modules -ra -l --tb=short --show-capture=stdout --color=yes | ||
testpaths = admin_confirm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
from .local import * # noqa | ||
# For some reason the working directory of tests | ||
# And running the server are different | ||
# (Possibly due to test_project being within a subfolder) | ||
# This defaults settings to local unless | ||
# DJANGO_SETTINGS is specified. | ||
from .local import * |