Skip to content

Commit 5d2790b

Browse files
feat: additional fields for purple API (ietf-tools#10299)
* feat: include group, abstract in purple draft API * feat: include ad/shepherd in purple API
1 parent ed209d2 commit 5d2790b

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

ietf/api/serializers_rpc.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ class FullDraftSerializer(serializers.ModelSerializer):
114114
# is used for a writeable view, the validation will need to be added back.
115115
name = serializers.CharField(max_length=255)
116116
title = serializers.CharField(max_length=255)
117+
group = serializers.SlugRelatedField(slug_field="acronym", read_only=True)
117118

118119
# Other fields we need to add / adjust
119120
source_format = serializers.SerializerMethodField()
120121
authors = DocumentAuthorSerializer(many=True, source="documentauthor_set")
121-
shepherd = serializers.SerializerMethodField()
122+
shepherd = serializers.PrimaryKeyRelatedField(
123+
source="shepherd.person", read_only=True
124+
)
122125
consensus = serializers.SerializerMethodField()
123126

124127
class Meta:
@@ -129,12 +132,16 @@ class Meta:
129132
"rev",
130133
"stream",
131134
"title",
135+
"group",
136+
"abstract",
132137
"pages",
133138
"source_format",
134139
"authors",
135140
"shepherd",
136141
"intended_std_level",
137142
"consensus",
143+
"shepherd",
144+
"ad",
138145
]
139146

140147
def get_consensus(self, doc: Document) -> Optional[bool]:
@@ -155,12 +162,6 @@ def get_source_format(
155162
return "txt"
156163
return "unknown"
157164

158-
@extend_schema_field(OpenApiTypes.EMAIL)
159-
def get_shepherd(self, doc: Document) -> str:
160-
if doc.shepherd:
161-
return doc.shepherd.formatted_ascii_email()
162-
return ""
163-
164165

165166
class DraftSerializer(FullDraftSerializer):
166167
class Meta:
@@ -171,6 +172,7 @@ class Meta:
171172
"rev",
172173
"stream",
173174
"title",
175+
"group",
174176
"pages",
175177
"source_format",
176178
"authors",

0 commit comments

Comments
 (0)