title: Pass Variable from View to Form Django
body: <p>Basically i am sending email to user with <code>password and username</code>. I can get the username using <code>self.cleaned_data.get('email')</code>. But the problem is that i dont know how to get password from view which i am setting random password in views. So please help me to get that random password from views.py to forms.py in <code>def send_email</code></p>
  
  <p>Forms.py    </p>
  
  <pre><code>class UserRegisterForm(forms.ModelForm):
          email = forms.EmailField()
          first_name = forms.CharField()
          last_name = forms.CharField()
  
          class Meta:
              model = User
              fields = ['first_name','last_name', 'email']
  
          def send_email(self):
              name = self.cleaned_data.get('first_name')
              username = self.cleaned_data.get('email')
              to_email = self.cleaned_data.get('email')
              password1 = # Get Password from view
  </code></pre>
  
  <p>Views.py</p>
  
  <pre><code>def register(request):
      if request.method == 'POST':
          ur_form = UserRegisterForm(request.POST)
          pr_form = UserProfileForm(request.POST, request.FILES)
          user_role = 0
          if ur_form.is_valid() and pr_form.is_valid():
              new_user = ur_form.save(commit=False)            
              new_user.username = new_user.email
              password = User.objects.make_random_password() # Pass This to Form send_email
              new_user.set_password(password)
              new_user.save()
  </code></pre>