I want to edit the Meta Class of a form that inherits its data from a ModelForm. All I want is to add one field, I don't want to repeat all the form.
# NuevaBibliotecaCompartida is a ModelForm
class EditarBibliotecaCompartida(NuevaBibliotecaCompartida):
    class Meta:
        fields = ('nombre', 'direccion', 'imagen', 'punto_google_maps')
I get the error ModelForm has no model class specified, of course, because I am overriding the Meta class when I add a field. How can I solve this?
You need to explicitly subclass the parent's Meta class:
class Meta(NuevaBibliotecaCompartida.Meta):
    # `model` will now be inherited
    fields = ('nombre', 'direccion', 'imagen', 'punto_google_maps')
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With