1👍
✅
In Django you can use Q()
objects to do OR searches.
from django.db.models import Q
link = link.strip('/')
Page.objects.filter(Q(url=link)|Q(url=link+'/')
As Daniel suggests in the comments, a better approach would be to normalise the urls as they are added, so that they either all have trailing slashes or none of them do.
Source:stackexchange.com