mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #10537: Fixed the foreign key add-another link in list_editable. Thanks, Alex and jezdez.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10235 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4e035a03b6
commit
4378af21b6
3 changed files with 26 additions and 3 deletions
|
@ -110,3 +110,16 @@ class AdminFormfieldForDBFieldWithRequestTests(DjangoTestCase):
|
|||
response = self.client.get("/widget_admin/admin_widgets/cartire/add/")
|
||||
self.assert_("BMW M3" not in response.content)
|
||||
self.assert_("Volkswagon Passat" in response.content)
|
||||
|
||||
class AdminForeignKeyWidgetChangeList(DjangoTestCase):
|
||||
fixtures = ["admin-widgets-users.xml"]
|
||||
|
||||
def setUp(self):
|
||||
self.client.login(username="super", password="secret")
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_changelist_foreignkey(self):
|
||||
response = self.client.get('/widget_admin/admin_widgets/car/')
|
||||
self.failUnless('/widget_admin/auth/user/add/' in response.content)
|
||||
|
|
|
@ -8,6 +8,9 @@ import models
|
|||
class WidgetAdmin(admin.AdminSite):
|
||||
pass
|
||||
|
||||
class CarAdmin(admin.ModelAdmin):
|
||||
list_display = ['make', 'model', 'owner']
|
||||
list_editable = ['owner']
|
||||
|
||||
class CarTireAdmin(admin.ModelAdmin):
|
||||
def formfield_for_foreignkey(self, db_field, request, **kwargs):
|
||||
|
@ -18,5 +21,6 @@ class CarTireAdmin(admin.ModelAdmin):
|
|||
|
||||
site = WidgetAdmin()
|
||||
|
||||
site.register(models.Car)
|
||||
site.register(models.User)
|
||||
site.register(models.Car, CarAdmin)
|
||||
site.register(models.CarTire, CarTireAdmin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue