I'm working through various Django tutorials in order to get an LDAP Backend up and running. I have a simple login page using a user's credentials, and an extra field to insert a user to be searched for. When hitting the submit button on my page, I get redirected to the correct html, but the url remains the same. I'm not sure that this could pose any problems, but if not, does it really matter if a different page has the same url? How should I be calling the redirected page?
urls.py
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', ldap_authentication, name='index'),
url(r'^logout/$', logout_view, name='logout'),
url(r'^search_page/$', ldap_authentication, name="search_page")
]
views.py
def ldap_authentication(request):
if request.POST:
username = request.POST['username']
password = request.POST['password']
searchFilter = request.POST['searchUser']
domain_and_login = '{}\\{}'.format(DOMAIN_NAME, username)
'''
Connection to LDAP...
'''
split_dn = [domain_and_login, "ou=Konzern", "dc=abcdef", "dc=de"]
return render(request, 'search_page.html', {'dn':split_dn})
return render(request, 'login.html')
If I do a redirect
, then I understand that Django looks this up in the urls.py, however the search_page.html doesn't have any view in the views.py.