On 4-7-2012 22:29, Tomas Neme wrote: > Besides that, if you don't want actual Base instances, then this is an > abstract class, and you should do this: > > class Base(models.Model): > eggs.... > plants.... > class Meta: > abstract=True > > class Foo(Base): > carpet=....
No, you /should/ not. You may do this, but you will end up with two tables that /do not share the records/. >From the OP's post it's obvious these classes share the data. Think of Base as a table 'fruit' and the other two as apples and oranges. In this case it doesn't make sense to duplicate the fruit data in the apples and oranges table. You would be using abstract models for much vaguer concepts, like I'm using: class NamedEntity(models.Model) : name = models.CharField(max_length=64, unique=True) description = models.TextField() class Meta : abstract = True ordering = [ 'name' ] class Device(NamedEntity) : interface = models.CharField(max_length=16) # .... class Category(NamedEntity) : pass In this case, you *want* device and category to be different tables for the shared data as they represent totally different concepts and can share names, but be totally different 'things' - like a 'cpu' category with description 'central processor and supporting hardware' and a 'cpu' device with description 'central processor device'. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.