1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

Fixed #373 -- Added CompositePrimaryKey.

Thanks Lily Foote and Simon Charette for reviews and mentoring
this Google Summer of Code 2024 project.

Co-authored-by: Simon Charette <charette.s@gmail.com>
Co-authored-by: Lily Foote <code@lilyf.org>
This commit is contained in:
Bendeguz Csirmaz
2024-04-07 10:32:16 +08:00
committed by Sarah Boyce
parent 86661f2449
commit 978aae4334
43 changed files with 3078 additions and 29 deletions

View File

@@ -5,7 +5,7 @@ from django.contrib.admin.sites import site
from django.core.exceptions import ImproperlyConfigured
from django.test import SimpleTestCase
from .models import Location, Person, Place, Traveler
from .models import Guest, Location, Person, Place, Traveler
class NameAdmin(admin.ModelAdmin):
@@ -92,6 +92,14 @@ class TestRegistration(SimpleTestCase):
with self.assertRaisesMessage(ImproperlyConfigured, msg):
self.site.register(Location)
def test_composite_pk_model(self):
msg = (
"The model Guest has a composite primary key, so it cannot be registered "
"with admin."
)
with self.assertRaisesMessage(ImproperlyConfigured, msg):
self.site.register(Guest)
def test_is_registered_model(self):
"Checks for registered models should return true."
self.site.register(Person)