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 <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.