0

I have a model.py with some common fields

Class Top(models.Model):

title = models.CharField(max_length=100)
.
.
<more fields here>
.
.
SELECT_CHOICES = (
    ('1', 'First'),
    ('2', 'Second'),
     .
     .
)
status = models.CharField(max_length=1, choices=SELECT_CHOICES)

what I am trying to achieve is:

  • display SELECT_CHOICES as dropdown select options of form

  • when the user/admin selects different options it appends different form fields at the bottom

  • I want to do it both on frontend and backend.

Example output:

Title = ......

<other Fields>

Selected = First

textField = .........



Title = ......

<other Fields>

Selected = Second

RadioButton = Option1 Option2

Can someone please guide me how can I do this in Django?

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
jayasth
  • 163
  • 1
  • 2
  • 6

0 Answers0