A more generic way to create URL based template

As mentioned in issue #17, the method used assumes that the lookup field is 'pk', but this in fact can be anything. This fixes that issue.
Another issue with the 'reverse' approach was that it wouldn't match ids which must include dashes or underscores, this takes care of that as well.

One problem I can see, if that the URL template from reverse_dict has more than one value.
The template looks like this:

resolver.reverse_dict["team-detail"]
([(u'api/v1/teams/%(id)s/', [u'id'])], 'api/v1/teams/(?P<id>\\d+)/$', {})

but django allows the urls to contain more than one dynamic segments:

([(u'api/v1/teams/%(id)s/blah/%(blahid)s', [u'id', u'blahid'])], ...)

But this wasn't considered either by the previous approach




`urlparse` has been renamed to `urllib.parse` in Python 3.