I am using Django rest framework rest-auth
for login and sign up. But I do not want to use the browseable API as my UI. I am building my own form.
so I am using a custom login url like so:
path('rest-auth/customlogin', CustomLoginView.as_view(), name='rest_login'),
where CustomLoginView
is defined as :
class CustomLoginView(LoginView):
def get(self, request):
return render(request, "api/test_template.html")
now in test_template.html
, I would like to have 2 input fields: email
and password
. the same fields that are shown in the browserable API if I did not overwrite with the template.
I am not sure how to get the request data into the template. (if email and password fields reside in the request data, is this correct?)
test_template.html
{% block content %}
<div class="row">
<h3>Login</h3><hr/>
{# I am not sure how to use input fields here where the data inputted goes in the email and password rest-auth fields#}
</div>
{% endblock %}