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 类和一个字段名,您如何测试该类是否具有给定名称的字段?
在这种情况下,字段名称是一个字符串。
例如:
field_name_exists = field_name in ModelName._meta.get_all_field_names()