but if i render a template inside codeview i dont know how to pass the form atributte and receive it
in the next function of this way
def receive(request, form):
the class LoginUser is a Login Form, after the user write his credentials a code authentication is needed, so, before send the login request inside form_valid that is “return form.login(request, redirect_url=reverse(‘index’))”, i call my template where the user should write the code authentication, that is codeview(request, form), here i receive the method form.login(…) and the post method of the template “codigo_login.html” redirect me to {% url ‘receive’ %}.
how can i send alse the atributte form together with the request ?
here in codeview i just send the request, but i dont know how to send the same form atributte
codeview redirect me to {% url ‘codeverification’ %}
so i need to receive the same atributte form in codeverification,to send the login request
def codeverificacion(request, form):
return form.login(request, redirect_url=reverse(‘index’))
Side note: When you’re posting code, please enclose the code fragments between lines consisting only of three backtick - ` characters. That means you would have one line of ```, followed by your lines of code, followed by another line of ```.
Example:
# The line above this one is ```
def function(self):
return self
# The line below this one is ```
As you can see, “fencing” your code like this allows it to maintain its formatting, making it much easier to read.
after submit de LoginForm the user receive a mail with the code and then submit that code in another template
thats why i’m trying to pass the form attribute , how can i receive that code of the other view and late send the login request in another view (form.login)?, i just need two pass the attribute/value ‘form’ between the views but render template doesn’t send more parameters than ‘request’
It might be easier at this point if you provide your complete views involved in this sequence. Talking in the abstract is not sufficient.
Also, please confirm whether or not the outline I provided above is the correct and complete desired sequence of events.
(To some degree, I’m getting the impression that we might be dealing with an “X/Y Problem”, and so I’d like to see the real code to try and get to what you’re really trying to accomplish.)
Copy and paste the complete views here. Don’t edit anything out of it or try to summarize it. (Both views, the view where the initial login form is being displayed and the view handling the authentication code.)