I am making a quiz web application and I want to create answers to questions from admin panel, not writing a code for each set of answers. How can I do that?
forms:
from django import forms
ANSWER_CHOICES = [
('1', 'First'),
('2', 'Second'),
('3', 'Third'),
]
class AnswerForm(forms.Form):
answer = forms.ChoiceField(
label = '',
required=False,
widget=forms.RadioSelect,
choices=ANSWER_CHOICES,
)
models:
from django.db import models
class Questions(models.Model):
title = models.CharField('Question', max_length=200)
def __str__(self):
return self.title