I'm just starting with django (and python too, to be honest)

I am trying to get a model method that would cut the self.slug from current URL and return it to template.

This is the method I tried:

```
class Category(models.Model):
    ...
    def remove_filter(self):
        url = HttpRequest.get_full_path()
        slug = '/' + self.slug
        return url.replace(slug, '')

```

But as you can imagine, it doesn't work.

Template's snippet:

```
{% for object in active_filters %}
    <li><a href="{{ object.remove_filter }}"><i class="icon-remove"></i></a>{{ object }}</li>
{% endfor %}

```

My core goal here is to have a front-end icon with a url altered by removing current object's slug.

I have no idea how to do it through views, but I'm open to any suggestions.

```
def category_page(request, url):
    slugs = url.split('/')
    active = Category.objects.filter(slug__in=slugs)
    sorted_slugs = []
    for i in active:
        sorted_slugs.append(i.slug)
    if slugs != sorted_slugs:
        url = '/'.join(sorted_slugs)
        return redirect('http://127.0.0.1:8000/catalog/' + url)
    inactive = Category.objects.exclude(slug__in=slugs)
    return render(request, 'category.html', {'active_filters': active,
                                              'inactive_filters': inactive})

```

Thanks.