title: Get Table selection and File in same form POST
body: <p>I have a django template that houses a django_table2 table, and also accepts a file:</p>
  
  <pre><code>{% extends 'portal/base.html' %}
  {% load render_table from django_tables2 %}
  {% block title %}{{user.first_name }} {{ user.last_name }} Portal{% endblock %}
  
  {% block content %}
  
      &lt;input type=button value="Back" onClick="javascript:history.go(-1);"&gt;
      &lt;h4&gt;Currently registered vehicles:&lt;/h4&gt;
      &lt;div class='vehlist'&gt;
          &lt;form action="/loadlocndb/" method="POST"&gt;
              {% csrf_token %}
              {% render_table veh_list %}
  
  
              &lt;h4&gt; Location database .csv file&lt;/h4&gt;
              &lt;input type="file" name="myfile"&gt;&lt;br/&gt;
              &lt;input type="submit" value="Submit" /&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>Currently the only thing passed back in <code>POST</code> is the selected table checkboxes. How do I also pass back the file as well.</p>
  
  <p>views.py</p>
  
  <pre><code>@login_required   
  def locndb(request):
      # This is the basic user landing Page
      veh_list =VehicleTable(Vehicle.objects.filter(company__user=request.user))
      form = LocnDBForm()
      RequestConfig(request).configure(veh_list)
      return render(request, 'portal/locndb.html', {"veh_list": veh_list, "form": form})
  
  @login_required   
  def loadlocndb(request):
  
  
      if request.method == "POST":
          pks = request.POST.getlist("update")
          print pks
          selected_objects = Vehicle.objects.filter(pk__in=pks)
  
          vlist = []
          for i in selected_objects:
              vlist.append(i)
  
          return render(request, 'portal/loadlocndb.html',{"vlist":vlist})
  </code></pre>
  
  <p>forms.py</p>
  
  <pre><code>from django import forms
  from django.contrib.auth.models import User
  from portal.models import UserProfile, Vehicle
  
  class UserForm(forms.ModelForm):
      password = forms.CharField(widget=forms.PasswordInput())
  
      class Meta:
          model = User
          fields = ('username', 'email', 'password')
  
  class UserProfileForm(forms.ModelForm):
      class Meta:
          model = UserProfile
          fields = ('milkco', 'compName')
  
  class LocnDBForm(forms.ModelForm):
      class Meta:
          model = Vehicle
          fields = ('vehid','locndb',)
  </code></pre>
  
  <p>vehicle model</p>
  
  <pre><code>class Vehicle(models.Model):
      vehid = models.CharField(max_length = 10)
      company = models.ForeignKey(UserProfile, default = 1)
      #depot = models.ForeignKey(Depot, default = 1)
      locndb = models.FileField(upload_to="optiload/", default= "setting.MEDIA_ROOT/locndb/LocnDB.csv")
  
      class Meta:
          db_table = "vehicle"
  
      def __unicode__(self):
          return self.vehid
  </code></pre>
  
  <p>Even better is how would stop the user from processing without selecting at least one entry in the table and also a file.</p>
  
  <p>Thanks</p>