我有一个抽象类Type
,它有3个继承类Type1 Type2 Type3
,这3个类的属性有70%是相同的。
我想要这样;
Tip=get_object_or_404(Type,tournament__slug=tournamentslug,slug=slug,game__slug=gameslug,)
但是,类型是抽象类,我无法获取对象或筛选器
views.py (现在)
def game_detail(request,tournamentslug,slug,gameslug):
tip1=get_object_or_404(Type1, tournament__slug=tournamentslug,slug=slug,game__slug=gameslug,)
tip2=get_object_or_404(Type2,tournament__slug=tournamentslug,slug=slug,game__slug=gameslug,)
tip3=get_object_or_404(Type3,tournament__slug=tournamentslug,slug=slug,game__slug=gameslug,)
https://stackoverflow.com/questions/57062945
复制相似问题