self-related objects list with links

The problem was to output self-related objects (like category objects which may be a sub-category in any category and so on) in unordered list with links to certain view (providing some object.id arg). Its somewhat like unordered_list tag but takes plain list of objects and provides links.

For example:

category_list = Category.objects.all()

In your template:

{% related_linked_list category_list view_category %}

This tag, however, have some limits:

Model shoud have self-related "parent" and id that may be passed into view.