Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ietf/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ def create_demo_draft(request):
request_params = json.loads(request.body)
name = request_params.get("name")
states = request_params.get("states")
stream_id = request_params.get("stream_id", "ietf")
exists = False
doc = None
if not name:
Expand All @@ -528,8 +529,13 @@ def create_demo_draft(request):
if doc:
exists = True
else:
kwargs = {"name": name}
kwargs = {"name": name, "stream_id": stream_id}
if states:
kwargs["states"] = states
doc = WgDraftFactory(**kwargs)
doc = WgDraftFactory(**kwargs) # Yes, things may be a little strange if the stream isn't IETF, but until we nned something different...
event_type = "iesg_approved" if stream_id == "ietf" else "requested_publication"
if not doc.docevent_set.filter(type=event_type).exists() # Not using get_or_crete here on purpose - these are wobbly facades we're creating
doc.docevent_set.create(type=event_type, by_id=1, desc="Sent off to the RPC")
return JsonResponse({ "doc_id":doc.pk, "name":doc.name })


2 changes: 2 additions & 0 deletions rpcapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ paths:
properties:
name:
type: string
stream_id:
type: string
states:
type: array
items:
Expand Down