mirror of
https://github.com/django/django.git
synced 2025-11-19 03:08:59 +00:00
Fixed #7984 -- 'View on site' links now work in inlines. Thanks philwo for the report and initial patch by julianb.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8586 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
05a4439581
commit
5a72589d7a
3 changed files with 5 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ from django.utils.html import escape
|
|||
from django.utils.safestring import mark_safe
|
||||
from django.utils.encoding import force_unicode
|
||||
from django.contrib.admin.util import flatten_fieldsets
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
class AdminForm(object):
|
||||
def __init__(self, form, fieldsets, prepopulated_fields):
|
||||
|
|
@ -114,6 +115,8 @@ class InlineAdminForm(AdminForm):
|
|||
def __init__(self, formset, form, fieldsets, prepopulated_fields, original):
|
||||
self.formset = formset
|
||||
self.original = original
|
||||
if original is not None:
|
||||
self.original.content_type_id = ContentType.objects.get_for_model(original).pk
|
||||
self.show_url = original and hasattr(original, 'get_absolute_url')
|
||||
super(InlineAdminForm, self).__init__(form, fieldsets, prepopulated_fields)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue