thorn.reverse
¶
Tools for URL references.
-
class
thorn.reverse.
model_reverser
(view_name, *args, **kwargs)[source]¶ Describes how to get the canonical URL for a model instance.
Examples
>>> # This: >>> model_reverser('article-detail', uuid='uuid') >>> # for an article instance will generate the URL by calling: >>> reverse('article_detail', kwargs={'uuid': instance.uuid})
>>> # And this: >>> model_reverser('article-detail', 'category.name', uuid='uuid') >>> # for an article instance will generate the URL by calling: >>> reverse('article-detail', ... args=[instance.category.name], ... kwargs={'uuid': instance.uuid}, ... )