Hi,

First see my models.py and admin.py before going into problem.

models.py ::


class Question(models.Model):
    question_text = models.CharField(max_length=128)
    topic = models.ForeignKey(Topic)
    category = models.CharField(max_length=20, choices=CATEGORY_CHOICES, 
default='Exam')
    subtopic = models.ForeignKey(SubTopic, blank=True, null=True)
    priority = models.CharField(max_length=128, choices=PRIORITY_CHOICES, 
default='Medium')
    solution = models.CharField(max_length=128, blank=True, null=True)
    image = models.ImageField(blank=True, null=True)
    published = models.BooleanField(default=False)
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.question_text

    class Meta:
        verbose_name_plural = "Questions"


class Answer(models.Model):
    question = models.ForeignKey(Question)
    choice_text = models.CharField(max_length=200)
    answer = models.BooleanField(default=False)
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)


admin.py ::

class AnswerInline(admin.TabularInline):
    model = Answer
    extra = 3


class QuestionAdmin(admin.ModelAdmin):
    list_display = ('question_text', 'topic', 'subtopic', 'created', 
'modified')
    model = Question
    inlines = [AnswerInline]

*based on Above i am getting check box to select in Tabular Inline. But i 
am looking for radio button so that only one answer will be selected. *

<https://lh3.googleusercontent.com/-lB99MXvGuWw/WTe_R9AAofI/AAAAAAAAFZ0/NY21m55gqnYLkDpq4Fxy6o8AX2TnKzStwCLcB/s1600/Screen%2BShot%2B2017-06-07%2Bat%2B4.00.36%2BPM.png>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/7d993940-ba69-4f5f-867d-d732be0d7cb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to