[Fixed]-How do use Foreign Key in slug django

1👍

give slug field to both faculty and program model. And in filter use __ for related lookups.

infor = get_object_or_404(Candidate, slug=slug, faculty__slug=faculty, program__slug=program)

you can do it by using with that name field too.

infor = get_object_or_404(Candidate, slug=slug, faculty__name=faculty, program__name=program)

Leave a comment