Pass the URL in the querystring of the requesting URL: http://127.0.0.1:8000/link/?link=https://www.geeksforgeeks.org/gate-cs-notes-gq/
The data from the querystring is available in the request.GET
dictionary in your view
def link_view(request):
if 'link' in request.GET:
objs = Links.objects.filter(link=request.GET['link']).values()
return HttpResponse(...)
else:
# Handle no link provided (views.get_text)
Your url patterns then only need to define one path that handles both cases where a URL is provided or not
urlpatterns = [
path('link/', views.link_view, name='link_view'),
]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…