My way or an easier way (templates)

That was not an understatement. I did struggle a lot with the ammount of data untill I started using the text find option in the browser. I did NOT find any reference to CheckboxSelectMultiple or even Checkbox. That got me confused.

I have

class EntityModelForm(ContextModelForm):
    class Meta:
        model = Entity
        fields = "__all__"

        widgets = {
            'addresses': forms.CheckboxSelectMultiple(),

            'websites': forms.CheckboxSelectMultiple(),

            'telephoneNumbers': forms.CheckboxSelectMultiple(),

            'emails': forms.CheckboxSelectMultiple(),
        }

And I used

class PersonModelForm(EntityModelForm):
    prefix="person"

    class Meta:
        model = Person
        fields = "__all__"

without the previous widgets in the view to create a new person

I asumed the widgets from the EntityModelForm where inherrited in PersonModelForm. But they are not. When I finally added:

        widgets = {
            'addresses': forms.CheckboxSelectMultiple(),

            'websites': forms.CheckboxSelectMultiple(),

            'telephoneNumbers': forms.CheckboxSelectMultiple(),

            'emails': forms.CheckboxSelectMultiple(),
        }

to the PersonModelForm it all worked.

So when extending a form like I did… where class PersonModelForm(EntityModelForm) extends class EntityModelForm(ContextModelForm) My conclusions are

  • class data like Meta data is not inherrited
  • data in the def __init__(self, *args, **kwargs): seems to pass over.

What is the best way to deal with this?