-1

i am wanna get url slug to show selected category by user on breadcumb. how can i get it? i found only wordpress and php solves.

template

<div class="breadcumb_area bg-img" style="background-image: url({% static 'img/bg-img/breadcumb.jpg' %});">
    <div class="container h-100">
        <div class="row h-100 align-items-center">
            <div class="col-12">
                <div class="page-title text-center">
                    <h2>dresses</h2>
                </div>
            </div>
        </div>
    </div>
</div>

1 Answers1

0

Even though you have not added the full code of breadcump.html. yet I can suggest you achieve it. we could help you much better if you would post full code.

To store slug, You can use django built-in SlugField https://docs.djangoproject.com/en/3.2/ref/models/fields/#slugfield

You can generate slug value from title or whatever you want using slugify method: from django.template.defaultfilters import slugify

I think this post will help you much more in this case.

How do I create a slug in Django?

and to render the slug url on django template

The post is very accurate solution: How to have Django templates display slugs

Note: Please avoid posting such common problems that already been answered by someone before