title: generating form for a simple survey-app
body: <p>I am writing an app for a simple survey.</p>
  
  <p>For possible answers I need "Yes/Now", "1 out of 1 to 5", and a short text</p>
  
  <p>In the admin it should be selectable, what kind of answer should be given.</p>
  
  <p>My models:</p>
  
  <pre><code>from django.db import models
  from django.contrib.contenttypes.models import ContentType
  
  CHOICES=((1,'excactly true'),(2,'mostly true'),(3,'mostly untrue'),(4,'untrue'),(5,'I don\'t know '))
  class Answer(models.Model):
      question = models.ForeignKey("Question")
  
  class ChoiceAnswer(Answer):
      answer = models.IntegerField(max_length=1, choices=CHOICES)
      def __unicode__(self):
          return u'%s: %s'%(self.question, self.answer)
  
  class TextAnswer(Answer):
      answer= models.CharField(max_length=255)
      def __unicode__(self):
          return u'%s: %s'%(self.question, self.answer)
  
  class BooleanAnswer(Answer):
      answer= models.BooleanField(choices=((True,'yes'),(False,'no')))
      def __unicode__(self):
          return u'%s: %s'%(self.question, self.answer)
  
  class Question(models.Model):
      question = models.CharField(max_length=255)
      answer_type = models.ForeignKey(ContentType)
  
      def __unicode__(self):
          return u'%s'%self.question
  </code></pre>
  
  <p>Is there a (hopefully: simple) way for generating the form by looping over all questions and creating the an answer form compatible to the question's answer_type?</p>
  
  <p>And is it possible to filter contenttypes for <code>answer_type = models.ForeignKey(ContentType)</code> so that only the answertypes will be shown?</p>