[Answered ]-Admin and Meta don't see the fields of parent abstract classes

2πŸ‘

βœ…

In the past, when I did not use the abstracts and just put everything into BookPage model, it all worked fine

Of course it worked fine because you put everything inside BookPage which is not an abstract class which means that table (and, thus, fields) will be created.

But it seems that Meta and Admin don’t see the fields in parent classes. Am I missing something?

You’re missing the fact that none of your models inherits from the GenericPage abstract model. Thus, the book field is never created.

Is there a way to make them read fields from abstract parents?

You must create/modify a model that inherits from an abstract model. Maybe, do this:

class GenericBookPage(GenericColorPage, GenericPage):

which allows you to inherit both GenericColorPage and GenericPage fields. When I say inherit I mean when the migrate command runs to actually create the database table and the relevant columns (model fields).

πŸ‘€nik_m

Leave a comment