Skip to content

Commit 457b950

Browse files
committed
fix: improvements to submit form validation
1 parent ff058e3 commit 457b950

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

ietf/submit/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ def clean(self):
707707
elif alias.document.get_state_slug() == "rfc":
708708
self.add_error(
709709
'replaces',
710-
forms.ValidationError("An Internet-Draft cannot replace an RFC"),
710+
forms.ValidationError("An Internet-Draft cannot replace another Internet-Draft that has become an RFC"),
711711
)
712712
elif alias.document.get_state_slug('draft-iesg') in ('approved', 'ann', 'rfcqueue'):
713713
self.add_error(

ietf/submit/tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,13 +3099,15 @@ def test_replaces_field(self):
30993099

31003100
# can't replace RFC
31013101
rfc = WgRfcFactory()
3102+
draft = WgDraftFactory(states=[("draft", "rfc")])
3103+
draft.relateddocument_set.create(relationship_id="became_rfc", target=rfc.docalias.first())
31023104
form = SubmissionAutoUploadForm(
31033105
request_factory.get('/some/url'),
3104-
data={'user': auth.user.username, 'replaces': rfc.name},
3106+
data={'user': auth.user.username, 'replaces': draft.name},
31053107
files=files_dict,
31063108
)
31073109
self.assertFalse(form.is_valid())
3108-
self.assertIn('An Internet-Draft cannot replace an RFC', form.errors['replaces'])
3110+
self.assertIn('An Internet-Draft cannot replace another Internet-Draft that has become an RFC', form.errors['replaces'])
31093111

31103112
# can't replace draft approved by iesg
31113113
existing_drafts[0].set_state(State.objects.get(type='draft-iesg', slug='approved'))

0 commit comments

Comments
 (0)