Thanks for replying. I'm ultimately trying to create a feedback form where there is a list of say 10 questions with 5 choices for response to each question. It also needs to be editable in the admin (and I can't get forms to be editable in the admin).
On Jul 12, 5:11 pm, Rodion Raskolnikiv <noah...@gmail.com> wrote: > Rupert, > Without knowing what you are aiming to accomplish, my advice might not > be pertinent. However, it looks like your models could be rearranged > like this: > > class Question(models.Model): > question = models.CharField(max_length=200) > pub_date = models.DateTimeField('date published') > > class Choice(models.Model): > poll = models.ForeignKey(Question) > choice = models.CharField(max_length=200) > votes = models.IntegerField() > > (Slightly modified from:http://docs.djangoproject.com/en/dev/intro/ > tutorial01/) > > On Jul 12, 1:49 pm, rupert <evan.fer...@gmail.com> wrote: > > > For this code: > > > class Title(models.Model): > > title = models.CharField(max_length=200) > > pub_date = models.DateTimeField('date published') > > > def __unicode__(self): > > return self.title > > > def was_published_today(self): > > return self.pub_date.date() == datetime.date.today() > > > class Question(models.Model): > > title = models.ForeignKey(Title) > > question = models.CharField(max_length=200) > > choice1 = models.CharField(max_length=200) > > choice2 = models.CharField(max_length=200) > > choice3 = models.CharField(max_length=200) > > choice4 = models.CharField(max_length=200) > > choice5 = models.CharField(max_length=200) > > > def __unicode__(self): > > return self.question > > > I'm trying to write a view where it outputs like this > > > Question > > > Choice 1-choice 5 in a radio button -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.