Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark_safe is added to create links between tables. #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions django_baker/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.core.validators import URLValidator
from django.db.models.fields import FieldDoesNotExist
from django.utils.encoding import smart_text
from django.utils.safestring import mark_safe

from functools import partial

Expand Down Expand Up @@ -95,8 +96,8 @@ def foreign_key_link(instance, field):
target = getattr(instance, field)
if not target:
return "None"
return u'<a href="../../%s/%s/%d">%s</a>' % (
target._meta.app_label, target._meta.model_name, target.id, smart_text(target))
return mark_safe(u'<a href="../../%s/%s/%d">%s</a>' % (
target._meta.app_label, target._meta.model_name, target.id, smart_text(target)))

if name[:9] == 'url_link_':
method = partial(url_link, field=name[9:])
Expand Down