+ if not self.accepts_subpath:
+ raise ViewDoesNotProvideSubpaths
+
+ view_name, args, kwargs = self.get_reverse_params(obj)
+ try:
+ return reverse(view_name, args=args, kwargs=kwargs, urlconf=self)
+ except NoReverseMatch:
+ raise ViewCanNotProvideSubpath
+
+ def get_reverse_params(self, obj):
+ """This method should return a view_name, args, kwargs tuple suitable for reversing a url for the given obj using self as the urlconf."""
+ raise NotImplementedError("View subclasses must implement get_reverse_params to support subpaths.")