title: Django ModelForm foreign key filtering
body: <p>I'm trying to filter foreign key field selections in my model form, but form isn't working. My scripts:</p>
  
  <p>forms.py</p>
  
  <pre><code>from django import forms
  from .models import Album, Song
  
  class SongCreateForm(forms.ModelForm):
  
      class Meta:
          model = Song
          fields = [
              'album',
              'name',
              'is_favorite'
          ]
          widgets = {
              'album': forms.Select(attrs={'class': 'form-control'}),
              'name': forms.TextInput(attrs={'class': 'form-control'}),
              'is_favorite': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
          }
  
      def __init__(self, user, *args, **kwargs):
          super(SongCreateForm, self).__init__(*args, **kwargs)
          self.fields['album'].queryset = Album.objects.filter(owner=user)
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>from django.views.generic import CreateView
  
  class SongCreateView(CreateView):
      template_name = 'music/song_create.html'
      success_url = '/songs/'
  
      def get_form(self, form_class=None):
          form_class = SongCreateForm(user=self.request.user)
          return form_class
          print(form_class.errors.as_data())
          print(form_class.is_valid())
  </code></pre>
  
  <p>song_create.html</p>
  
  <pre><code>{% extends 'base.html' %}
  
  {% block content %}
  &lt;form method="post"&gt;{% csrf_token %}
    {% if form.errors %}
      &lt;p&gt;{{ form.errors }}&lt;/p&gt;
    {% endif %}
    &lt;div class="form-group"&gt;
      &lt;label for="{{ form.album.id_for_label }}"&gt;Album&lt;/label&gt;
      {{ form.album }}
    &lt;/div&gt;
    &lt;div class="form-group"&gt;
      &lt;label for="{{ form.name.id_for_label }}"&gt;Name&lt;/label&gt;
      {{ form.name }}
    &lt;/div&gt;
    &lt;div class="form-check"&gt;
      &lt;label for="{{ form.is_favorite.id_for_label }}" class="form-check-label"&gt;
      {{ form.is_favorite }}Favorite
      &lt;/label&gt;
    &lt;/div&gt;
    &lt;button type="submit" class="btn btn-primary" value="Save"&gt;Add&lt;/button&gt;
  &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>Filtering queryset of 'album' field is working correctly. It is displaying only albums that are associated with authenticated user, but when I click submit in form browser doesn't redirect me to success url and song isn't added to database. I've added two print statements at the end of views.py to check that form is valid and has any errors. While form.errors returning <strong>empty dictionary</strong>, form.is_valid() is equal to <strong>False</strong>. Why Django treats this form as invalid, if it doesn't have any errors?</p>
  
  <p><strong>Note:</strong> SongCreateView works successfully, when I comment out <strong>init</strong> function in forms.py and <strong>get_form</strong> function in views.py.</p>