[Answer]-Why do we need fields value in Meta class in Django forms?

1👍

“The generated Form class will have a form field for every model field specified, in the order specified in the fields attribute.”

If you want to hide fields, use

exclude = ('views','likes','slug')

I highly recommend you to take a look at the docs:

https://docs.djangoproject.com/en/1.8/topics/forms/modelforms/#selecting-the-fields-to-use

👤Sativa

Leave a comment