Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
DjangoでモデルのAbstractClassを取得するにはどうすればよいですか? タイプでやろうとしましたが、タイプはdjangoのBaseModelクラスまたはモデル自体のタイプを提供します。
def go_for_the_bases(model): while hasattr(model, '_meta'): model = model.__base__ if hasattr(model, '_meta') and model._meta.abstract == True: yield model