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のモデルフィールドの数を取得するにはどうすればよいですか?
_metaモデルの属性を確認する必要があります。
_meta
In [1]: from django.contrib.auth.models import User In [2]: len(User._meta.fields) Out[2]: 11 In [3]: len(User._meta.many_to_many) Out[3]: 4