Add new, slightly different URL mixin

* Refactor the existing code to make the new functionality
  slot in nicely.
* Add a slightly different URLsMixin to deal with method-
  based views as opposed to class-based views.  The two
  mixins derive from a shared base class and are used
  in the same way.
* 'URLsMixin' and 'URLsTestCase' do the same thing as
  before, for the sake of compatibility.