fix bug 794591 - Allowing special tag widget on 'new doc' page
fix bug 795011 - Prevent discussion learn error
Merge pull request #621 from darkwing/remove-discussion-reference

fix bug 795011 - Prevent discussion learn error
Prevents other discussion URL issue
Merge pull request #622 from darkwing/remove-discussion-reference-2

Prevents other discussion URL issue
Merge pull request #618 from darkwing/new-tags-794591

fix bug 794591 - Allowing special tag widget on 'new doc' page
Fix bug 785212: Method for getting all children of a page

This is a somewhat naive recursive implementation that descends
through children, grandchildren, etc. and builds up a data structure
that clearly shows the relationships and sub-trees and so forth.

It is naive in the sense that A) it does not attempt to minimize the
number of DB queries involved in building the tree, and B) currently
has no way at all of detecting a circular dependency.
Fix bug 785214 -- detect existence of children

Adds a method for detecting whether a document has at least one child
(which will eventually kick over to the tree-move interface). Also
adds a basic method for detecting potential circular trees of
documents, which has uses in this and other parts of page-moving.
Fix bug 785216: Backend support for moving trees of pages.

This puts the page-move logic into two methods on Document. One is
simply a shift of the old bits for leaving a redirect behind, into a
new method move(). The other, _move_tree(), recursively moves the
document (by changing its slug) and all of its children.
Add a bit of special-case logic in tree-moving.

The slug manipulation for tree moves is implemented using basic string
replace operations, but this fails on the "special" (albeit likely
common) case of simply wanting to stick a prefix onto the beginning of
the slug. This could be implemented by resorting to regular-expression
replacement that's aware of the position to insert at, but it's far
simpler to just treat this as a special case.
Clean up get_descendants()

This originally returned a somewhat complex data structure that was
hard to work with in places where it was needed, and which served no
real purpose. So now it just returns a list.
Detect conflicts when moving a tree of pages.

This adds some new logic that works out both the target slug of the
top-level document, and the target slugs of all the children, and
spits out a handy list of any existing non-redirect pages which
already exist at those slugs in the same locale.
Add a form for tree moves.

This doesn't actually move anything -- that's the view's job -- but we
do need to have the same validation of the slug that we'd do on any
other edit (and since that's the only thing changing in a move, it's
also the only field we care about).
Fix bug 785216: Backend support for moving trees of pages.

This adds a form and a view for actually moving trees of pages, with
the following features:

* Editing a single page continues to work normally, unless an attempt
  is made to edit the slug and the page has children. In that case, we
  redirect to the page-move interface.

* Moving a tree of pages requires the page-move permission.

* The move view supplies a list of all child pages which will be
  affected.

* Attempting to move a tree of pages will check for any conflicts
  (existing pages which would be overwritten) and bail out with an
  error to the user.
Adding UI to document move backend
Cosmetic renaming of arguments to _move_tree to make it clear what's
really going on in that method.
Remove some slug-editing tests.

This is not just a "remove tests until they pass"; with page-moving as
part of kuma, these tests are no longer valid, since they're
exercising cases that are no longer handled by document
editing. Instead, attempts to edit slugs in this fashion end up at the
page-moving interface, which breaks the assumptions behind these
tests.
Fix _tree_conflicts to always return the list of conflicts.

(the indentation here was off, I believe due to some overzealous surgery)
Only show page-move button if a page has children.

This avoids some weirdness in trying to bring all the tree-moving
machinery to bear on a single page, when single pages with no children
can already be moved implicitly by normal editing of their slugs.
Preserve tags and review tags when moving.

Tags were already being kept because they're a fairly normal field
(though now a test proves this). Review tags are a bit more complex,
and now are explicitly stored temporarily during page moving so that
they can be added back to the new revision that comes out the other
side.