Django Inheritance and Permalinks

后端 未结 3 736
孤城傲影
孤城傲影 2021-01-07 05:25

I\'m creating a simple CMS in django, with multiple \"modules\" (each as a django app). I\'ve set up the following models:

class FooObject(models.Model):
            


        
3条回答
  •  抹茶落季
    2021-01-07 06:21

    The classic solution to this problem tends to be adding a ContentType to the superclass which stores the type of subclass for that instance. This way you can rely on a consistent API that returns the related subclass object of the appropriate type.

提交回复
热议问题