title: context processor: how to write login and signup in all views
body: <p>I created a view for Login/Signup/Forget Password (5 forms in single view). I need these forms in header so I added links in base.html and extended in all templates. How can I make this view available for all templates. </p>
  
  <pre><code>def master_link(request):
      login_form = UserLoginForm()
      send_otp_form = SendOTPForm()
      verify_otp_form = VerifyOTPForm()
      registration_form = RegistrationForm()
      forget_password_form = ForgetPasswordForm()
      if request.method == 'POST' and 'login_submit' in request.POST:
          login_form = UserLoginForm(request.POST)
  
          if login_form.is_valid():
              user = login_form.login(request)
              if user:
                  login(request, user)
                  return HttpResponseRedirect(reverse('home'))
  
      elif request.method == 'POST' and 'send_otp_submit' in request.POST:
          send_otp_form = SendOTPForm(request.POST)
  
          if send_otp_form.is_valid():
              mobile_number = send_otp_form.cleaned_data['mobile_number']
              type_otp = send_otp_form.cleaned_data['type']
              otp = random.randint(1000, 9999)
              otpobj = sendotp.sendotp.sendotp(settings.AUTH_KEY, str(otp) + ' keep otp with you.')
              otpobj.send(mobile_number, 'TestOTP', otp)
              return HttpResponseRedirect(reverse('verify_otp', args=(mobile_number, type_otp)))
  
      elif request.method == 'POST' and 'signup_submit' in request.POST:
          registration_form = RegistrationForm(request.POST)
          if registration_form.is_valid():
              user = registration_form.save(commit=False)
              mobile_number = registration_form.cleaned_data['mobile_number']
              user.username = registration_form.cleaned_data['mobile_number']
              password = registration_form.cleaned_data['password']
              gender = request.POST.get('inlineRadioOptions')
              user.gender = gender
              user.mobile_number = mobile_number
              user.set_password(password)
              user.save()
              new_user = authenticate(username=mobile_number, password=password)
              login(request, new_user)
              return HttpResponseRedirect(reverse('home'))
  
      elif request.method == 'POST' and 'forget_password_submit' in request.POST:
          forget_password_form = ForgetPasswordForm(request.POST)
          if forget_password_form.is_valid():
              password = forget_password_form.cleaned_data['password']
              mobile_number = forget_password_form.cleaned_data['mobile_number']
              user = User.objects.get(mobile_number=mobile_number)
              user.set_password(password)
              user.save()
              return HttpResponseRedirect(reverse('home'))
  
      elif request.method == 'POST':
          verify_otp_form = VerifyOTPForm(request.POST)
          if verify_otp_form.is_valid():
              return HttpResponseRedirect(reverse('home'))
  
      # SportsMaster
      sports_data = SportsMaster.objects.all()
  
      context = {
          'login_form': login_form,
          'send_otp_form': send_otp_form,
          'verify_otp_form': verify_otp_form,
          'registration_form': registration_form,
          'forget_password_form': forget_password_form,
          'sports_data':sports_data,
      }
      return render(request, 'user_front/user_login.html', context)
  </code></pre>
  
  <p>I can't write these functions in all views. I know I can use context processor to send variables in all templates but how can I use these functions in all views. Also I have 3 apps and I have to send these variables only in 1 app.</p>