--- On Sat, 11/20/10, marco.ferrag...@gmail.com <marco.ferrag...@gmail.com> wrote:
From: marco.ferrag...@gmail.com <marco.ferrag...@gmail.com> Subject: problems with model inheritance if base class is not abstract To: "Django users" <django-users@googlegroups.com> Date: Saturday, November 20, 2010, 5:59 AM Hi all! I'm new to django and I'm experimenting with models but I have some trouble. I've minimized my problem to this code: class TestBase(models.Model): base = models.CharField(max_length=255) from django.contrib import admin class TestA(TestBase): testb = models.CharField(max_length=255) admin.site.register(TestA) class TestB(TestBase): testc = models.CharField(max_length=255) admin.site.register(TestB) Trying to add TestA instances from admin interface I have this error: Cannot assign "''": "TestA.testb" must be a "TestB" instance. why testb should be a TestB instance?? It's a simple field! If TestBase is declared as abstract using the internal Meta Class I no more have the error. Is this a bug or there is something that I don't understand? Thanks in advance :) I think your issue is in how you are registering is should look like admin.site.register(TestBase, TestA) admin.site.register(TestBase, TestB) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.