Repository: mdn/kuma

Issue:
/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype
# Request type
<!-- Select the appropriate option -->
- [ ] Please close this issue, I accidentally submitted it without adding any details
- [ ] New documentation
- [x] Correction or update


# Details
I was trying to make it redirect to the main `Array` document, but I can't edit it. (404)
Seems like that if the upstream document (`/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype`) is removed, localized ones throw 404 in `$edit`.


Discussion:
So basically, you want 

https://wiki.developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype

to just redirect to 

https://wiki.developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array

In which case, yes, confirmed. When I try to edit https://wiki.developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype to put the redirect in place, it gives me a 404.

I think this needs to be fixed by the devs; I'm going to transfer it over to the kuma repo.
It's not the first time we've seen this. The reasons is that https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array is deleted. (aka. soft delete)
<img width="1162" alt="Screen Shot 2020-02-10 at 11 28 30 AM" src="https://user-images.githubusercontent.com/26739/74169130-d2460c00-4bf8-11ea-9e7f-67a391d4bce8.png">

I think a simple solution is to dig into the `$edit` and wherever it looks up its parent, it should also accept that the parent might be (soft) deleted. 
Perhaps also, a warning message somewhere too. 
I can reproduce this locally. 
@atopal we've put this as a p3, but feel free to prioritize.
FYI, https://github.com/mdn/kuma/pull/6455 solves the problem. It'll get you back into being able to edit those documents at least. 
p3 sounds right
I do see it fixed, but still getting 404 from _submitting_ any edit. That is, fixed for GET, not for POST:
![주석 2020-02-20 012342](https://user-images.githubusercontent.com/9212605/74852307-b9b7bd80-537f-11ea-8ccf-4768c5a2ff2a.png)

(pinging @peterbe)

Edit: I accidently linked the child to [https://wiki.developer.mozilla.org/en-US/docs/Experiment:StaticExamplesOnTop/JavaScript/Array/prototype](https://wiki.developer.mozilla.org/en-US/docs/Experiment:StaticExamplesOnTop/JavaScript/Array/prototype), so I _did_ made the edit. The 404 remains, in a normal circumstances.
Yep. I can reproduce it. 

Resolving patch:
diff --git a/kuma/wiki/views/translate.py b/kuma/wiki/views/translate.py
--- a/kuma/wiki/views/translate.py
+++ b/kuma/wiki/views/translate.py
@@ -220,7 +220,10 @@ def translate(request, document_slug, document_locale):
                 # Attempt to set a parent
                 if parent_id:
                     try:
-                        parent_doc = get_object_or_404(Document, id=parent_id)
+                        try:
+                            parent_doc = Document.all_objects.get(id=parent_id)
+                        except Document.DoesNotExist:
+                            raise Http404("Parent document does not exist")
                         rev_form.instance.document.parent = parent_doc
                         doc.parent = parent_doc
                         rev_form.instance.based_on.document = doc.original


Test patch: