title: django: use a queryset as modelform initial data
body: <p>I'm making a settings interface which works by scanning for a settings folder in the installed applications, scanning for settings files, and finally scanning for ModelForms.</p>
  
  <p>I'm at the last step now. The forms are properly found and loaded, but I now need to provide the initial data. The initial data is to be pulled from the database, and, as you can imagine, it must be limited to the authenticated user (via request.user.id).</p>
  
  <p>Keep in mind, this is all done dynamically. None of the names for anything, nor their structure is known in advanced (I really don't want to maintain a boring settings interface).</p>
  
  <p>Here is an example settings form. I just pick the model and which fields the user can edit (this is the extent to which I want to maintain a settings interface).</p>
  
  <pre><code>class Set_Personal_Info(forms.ModelForm):
      class Meta:
          model = UserProfile
          fields = ('nick_name', 'url')
  </code></pre>
  
  <p>I've looked at modelformset_factory which <em>almost</em> does what I want to do, but it only seems to work with results of two or more. (Here, <em>obj</em> is one of the settings forms)</p>
  
  <pre><code>Formset = modelformset_factory(obj.Meta.model, form=obj)
  Formset(queryset=obj.Meta.model.objects.filter(id=request.user.id))
  </code></pre>
  
  <p>I can't filter the data, I have to get one, and only one result. Unfortunately I can't use get()</p>
  
  <pre><code>Formset = modelformset_factory(obj.Meta.model, form=obj)
  Formset(queryset=obj.Meta.model.objects.get(id=request.user.id))
  </code></pre>
  
  <blockquote>
    <p>'User' object has no attribute 'ordered'</p>
  </blockquote>
  
  <p>Providing the query result as initial data also doesn't work as it's not a list.</p>
  
  <pre><code>Formset = modelformset_factory(obj.Meta.model, form=obj)
  Formset(initial=obj.Meta.model.objects.get(id=request.user.id))
  </code></pre>
  
  <blockquote>
    <p>'User' object does not support indexing</p>
  </blockquote>
  
  <p>I have a feeling that the answer is right in front of me. How can I pull database from the database and shove it into the form as initial values?</p>