Django return HttpResponseRedirect to an url with a parameter

前端 未结 5 681
面向向阳花
面向向阳花 2020-12-24 11:24

I have a situation in my project where i need to make a redirection of the user to an url containing a parameter, (it is declared in the urls.py like:

url(r         


        
5条回答
  •  感情败类
    2020-12-24 12:16

    If you are submitting to the same URL, you can use the following to pass parameters.

     template_name = '/classroom/notamember.html'
    
    return render(
                    request,
                    self.template_name,
                    {'classname': 'classname', 'secondvariable': 'variable' }
                )
    

提交回复
热议问题