0

I have an IntegerField with choices.

The list of choices consists of 10 different choices. I have different ModelForm using this integerfield.

In some of the modelforms I don't want to display all of the choices.

Can I in the ModelForm reduce the number of available choices?

Jamgreen
  • 10,329
  • 29
  • 113
  • 224

1 Answers1

0

You need to make a new form class that is a subclass of ModelForm. Then the __init__ method of the ModelForm class change one of the things in self.fields after calling the superclass constructor.

Jakob Weisblat
  • 7,450
  • 9
  • 37
  • 65