I'm developing a project that have not any slug field and this value create in template by:
{{ n.title|slugify }}
I have to use slug an jquery code, but variable aleays empty:
$("select#model").click(function() {
var u = $(this).find(":selected").val();
var slg = $(this).find(":selected").text();
var slug = "{{ slg|slugify }}";
window.location.href("link that createt with u and slug);
});
Is there anyway to using django template tag inside javascript?
Edit :
I have a queryset:
Model.objects.all()
How can I add manually field in this queryset?