Reputation: 21
I want to call a function from another function in django. The function looks like this
def main_view(request):
if request.method == 'GET':
I dont want to have the url to main_view open so that user can access this url directly, instead they should face a login page(just a lot of checkboxes that the four right ones should be choosen) and after that submit, they should come to the template that the main_view function is rendering.
But, how do I actually call function internal that need a request GET input? Is there a way to do a GET request when calling the function?
//Mikael
Upvotes: 2
Views: 1786
Reputation: 15506
You can just pass the request from your other view into that one, like this:
def my_public_view(request):
if user_passed_checkbox_test():
return main_view(request)
Upvotes: 1