We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1a0136 commit 48a927bCopy full SHA for 48a927b
src/packagedcode/models.py
@@ -87,11 +87,19 @@ def create(cls, **kwargs):
87
provided in ``kwargs`` that do not exist as declared attr fields in
88
``cls``.
89
"""
90
- known_attr = attr.fields_dict(cls)
+ known_attr = cls.fields()
91
kwargs = {k: v for k, v in kwargs.items() if k in known_attr}
92
return cls(**kwargs)
93
94
95
+ @classmethod
96
+ def fields(cls):
97
+ """
98
+ Return a list of field names defined on this model.
99
100
+ return list(attr.fields_dict(cls))
101
+
102
103
party_person = 'person'
104
# often loosely defined
105
party_project = 'project'
0 commit comments