please tell me the best way to construct a Model of Quiz form

21 views
Skip to first unread message

Jun Tanaka

unread,
Mar 8, 2016, 8:20:32 AM3/8/16
to Django users
Hi,

I am trying to make a form for Quizzes. I hope to know how to construct a model which be added choices. A model should be constructed by three parts as 

Question
the number of right answer
several buttons to choose

for example of a model,
class Quiz(models.Model):
    question = models.CharField( max_length=40)
    image_url = models.URLField(blank=True, null=True)
    correct_ans_num = models.IntegerField(default=1,editable=True)
    button1 = models.CharField(help_text=u'button1', max_length=20)
    button2 = models.CharField(help_text=u'button2', max_length=20)
    button3 = models.CharField(help_text=u'buton3', max_length=20)


But a problem here is the number of buttons i fixed. I prefer to add buttons later, and hopefully be able to input data in one admin page.
Please tell me what your best solution of a model should be like. 

Jun



Avraham Serour

unread,
Mar 8, 2016, 1:39:13 PM3/8/16
to django-users
I believe a model similar to the poll app from the tutorial would be appropriate


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5380222-7afd-4ffc-a3a7-04864161ec38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages