Steps to reproduce:
1. Log in
2. Hi, username! > My Preferences > Manage My Pseuds > New Pseud
3. Fill in the "Name" field with a name for your pseud, e.g. Pseud To Orphan
4. Press "Create"
5. Back To Pseuds > New Pseud
6. Fill in the "Name" field with a name for your pseud, e.g. Pseud To Keep
7. Press "Create"
8. Post > New Work
9. Fill in required fields
10. Under "Creator/Pseud(s)," choose both Pseud To Orphan and Pseud To Keep
11. Press "Post Without Preview"
12. Hi, username! > My Preferences > Manage My Pseuds
13. Under "Pseud To Orphan," press "Orphan Works"
14. Leave "Take my pseud off as well" selected
15. Press "Yes, I'm Sure"
I get a 500 error, but the work is properly orphaned: the pseud "Pseud To Orphan" is removed from the work and replaced with "orphan_account," while "Pseud To Keep" stays on the work.
What should happen:
Instead of receiving an error page, I should be redirected to my dashboard (http://test.archiveofourown.org/users/USERNAME) with a success message saying, "Orphaning was successful."
The same error happens if you choose "Leave a copy of my pseud on" in step 14. Orphaning a work with only one pseud attached works just fine.