mirror of
https://github.com/django/django.git
synced 2025-10-30 00:56:09 +00:00
Fixed #12004 -- Improved error reporting when an abstract class is registered with the admin. Thanks to Matt Smalley for the report, and to mk and Julien Phalip for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15636 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
from django.test import TestCase
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.contrib import admin
|
||||
|
||||
from models import Person, Place
|
||||
from models import Person, Place, Location
|
||||
|
||||
class NameAdmin(admin.ModelAdmin):
|
||||
list_display = ['name']
|
||||
@@ -52,3 +52,10 @@ class TestRegistration(TestCase):
|
||||
isinstance(self.site._registry[Place], admin.options.ModelAdmin)
|
||||
)
|
||||
self.assertEqual(self.site._registry[Place].search_fields, ['name'])
|
||||
|
||||
def test_abstract_model(self):
|
||||
"""
|
||||
Exception is raised when trying to register an abstract model.
|
||||
Refs #12004.
|
||||
"""
|
||||
self.assertRaises(ImproperlyConfigured, self.site.register, Location)
|
||||
|
||||
Reference in New Issue
Block a user