title: Django form as_table(), as_p() methods not working
body: <p>I have a simple form class with the following single field defined:</p>
  
  <pre><code>class LaunchForm(forms.Form):
  
      file_name = forms.FileField(required=True, label='File to import')
  </code></pre>
  
  <p>in my template I have:</p>
  
  <pre><code>&lt;form action="" method="post"&gt;
      {{ form.file_name }}
      &lt;table&gt;
          {{ form.as_table }}
      &lt;/table&gt;
      {% csrf_token %}
      &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The form is being invoked from the view as follows:</p>
  
  <pre><code>class Application_Launch_View(View):
  
      form_class = LaunchForm
      template_name = 'application_launch.html'
  
      def get(self, request, app_id):
          form = self.form_class(application_id=app_id)
          return render(request, self.template_name, {'form': form})
  </code></pre>
  
  <p>I put the variable <strong>{{ form.file_name }}</strong> into the template just to verify that the form field exists. What is appearing on the page in my browser (along with all the other stuff in the template) is:</p>
  
  <pre><code>&lt;django.forms.fields.FileField object at 0x032A08F0&gt; 
  </code></pre>
  
  <p>But the form.as_table doesn't seem to be yielding anything.</p>
  
  <p>I tried issuing the following function calls immediately after instantiating the form in my view, just before invoking the render() function:</p>
  
  <p>print(form.file_name)
  print(form.as_table()) </p>
  
  <p>The server log shows:</p>
  
  <pre><code>&lt;django.forms.fields.FileField object at 0x032A08F0&gt;
  </code></pre>
  
  <p>Followed by a blank space. If I remove the call to as_table(), the blank space does NOT appear. I tried substituting form.as_p() in the view, but get the same results, so it appears both methods are at least outputting a CR or CR/FL pair.</p>
  
  <p>It looks like everything is working except the <strong>as_table()</strong> and <strong>as_p()</strong> methods, and I can't figure out why...</p>
  
  <p>+++++++++++++++++++</p>
  
  <p>In looking into this a little deeper, I noticed that another form, when referencing a Django field object on the form from within the template doesn't yield the object class description as I posted above, but the expected form field.</p>
  
  <p>So I have to ask, what is the difference between the two methods below for establishing a form field, and is there a way of making the second method (within the <code>__init__()</code>) work?</p>
  
  <p>Method 1 (this works):</p>
  
  <pre><code>class LaunchForm:
  
      file_name = forms.FileField(required=True,
                          label='File to import',
                          initial='Default value')
  </code></pre>
  
  <p>Method 2 (this isn't working):</p>
  
  <pre><code>class LaunchForm:
  
      def __init__(self, *args, **kwargs)
  
          self.file_name = forms.FileField(required=True,
                          label='File to import',
                          initial='Default value')
  </code></pre>