title: How to get a value in a database and display on django form
body: <p>I have a <strong>DuesLevy</strong> model with a field called <strong>user</strong> which happen to be a foreign key to my <strong>User</strong> model. I want to display email value from the User model to my form <strong>AddMemberDuesForm()</strong></p>
  <p>The reason is this I want to get the email and amount value and pass it to my payment processor.
  I am using class based views to process my form below is my code<br>
  <strong>forms.py</strong></p>
  <pre><code>class AddMemberDuesForm(forms.ModelForm):
      class_of_dues = forms.CharField(required=False, widget=forms.Select(choices=options.CLASS_OF_DUES, attrs={'class':'form-control'}))
      payment_circle = forms.CharField(required=False, widget=forms.Select(choices=options.PAYMENT_CIRCLE, attrs={'class':'form-control'}))
      payment_option = forms.CharField(required=False, widget=forms.Select(choices=options.PAYMENT_OPTION, attrs={'class':'form-control'}))
      payment_channel = forms.CharField(required=False, widget=forms.Select(choices=options.PAYMENT_CHANNEL_TYPE, attrs={'class':'form-control'}))
      amount = forms.DecimalField(widget=forms.NumberInput(attrs={'class':'form-control'}))
      payment_date = forms.DateField(widget=forms.DateInput(attrs={'class':'form-control', 'type':'date'}))
      
      description = forms.CharField(widget=forms.Textarea(attrs={'class':'form-control'}))
  
  
      class Meta():
          model = DuesLevy
          exclude = ('date_recorded', 'start_date', 'end_date', 'transaction_id')
  </code></pre>
  <p><strong>views.py</strong></p>
  <pre><code>class AddMemberDues(LoginRequiredMixin, CreateView):
      login_url = '/backoffice/'
      model = DuesLevy
      template_name =  'dashboard/add-edit-member-dues.html'
      form_class = AddMemberDuesForm
      context_object_name = 'member_form'
  
      def post(self, request, *args, **kwargs):
         form = AddMemberDuesForm(request.POST)
         if form.is_valid():
             form = AddMemberDuesForm()
             form.user.email = form.user.cleaned_data['email']
             self.template_name = 'dashboard/payment.html'
             form.save()
             return render(request,  self.template_name,
              {'email': form.cleaned_data['email'], 'amount': form.cleaned_data['amount']}) 
  
      def get(self, request, *args, **kwargs):
          initial = {'email':request.user.email}
          form = AddMemberDuesForm(initial=initial)
          return render(request, self.template_name, {'email': form.cleaned_data['email']})
  </code></pre>
  <p>I get this error in the</p>
  <pre><code>'AddMemberDuesForm' object has no attribute 'cleaned_data'
  
  Internal Server Error: /backoffice/add-member-dues/                                       
  Traceback (most recent call last):                                                        
    File &quot;C:\Users\Benedict\Miniconda3\envs\mycda\lib\site-packages\django\core\handlers\exception.py&quot;, line 34, in inner                                                             
      response = get_response(request)                                                      
    File &quot;C:\Users\Benedict\Miniconda3\envs\mycda\lib\site-packages\django\core\handlers\base.py&quot;, line 115, in _get_response                                                         
      response = self.process_exception_by_middleware(e, request)                           
    File &quot;C:\Users\Benedict\Miniconda3\envs\mycda\lib\site-packages\django\core\handlers\base.py&quot;, line 113, in _get_response                                                         
      response = wrapped_callback(request, *callback_args, **callback_kwargs)               
    File &quot;C:\Users\Benedict\Miniconda3\envs\mycda\lib\site-packages\django\views\generic\base.py&quot;, line 71, in view                                                                   
      return self.dispatch(request, *args, **kwargs)                                        
    File &quot;C:\Users\Benedict\Miniconda3\envs\mycda\lib\site-packages\django\contrib\auth\mixins.py&quot;, line 52, in dispatch                                                              
      return super().dispatch(request, *args, **kwargs)                                     
    File &quot;C:\Users\Benedict\Miniconda3\envs\mycda\lib\site-packages\django\views\generic\base.py&quot;, line 97, in dispatch                                                               
      return handler(request, *args, **kwargs)                                              
    File &quot;D:\mycda\backend\views.py&quot;, line 348, in get                                      
      return render(request, self.template_name, {'email': form.cleaned_data['email']})     
  AttributeError: 'AddMemberDuesForm' object has no attribute 'cleaned_data'
  </code></pre>