"from django.urls import path, url" code example
Example 1: how to get the current url path in django template
{{ request.path }} # -without GET parameters
{{ request.get_full_path }} # - with GET parameters
Example 2: get_absolute_url django
def get_absolute_url(self):
from django.core.urlresolvers import reverse
return reverse('', kwargs={'pk': self.pk})