user2042423
user2042423

Reputation: 21

call internal view function in django

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

Answers (1)

girasquid
girasquid

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

Related Questions