[Django]-Django's ModelForm โ€“ where is the list of Meta options?

36๐Ÿ‘

โœ…

Had this question myself today. For completeness, here is the documentation that currently exists:

https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#modelforms-overriding-default-fields

And an excerpt from django/forms/models.py:

class ModelFormOptions:
    def __init__(self, options=None):
        self.model = getattr(options, 'model', None)
        self.fields = getattr(options, 'fields', None)
        self.exclude = getattr(options, 'exclude', None)
        self.widgets = getattr(options, 'widgets', None)
        self.localized_fields = getattr(options, 'localized_fields', None)
        self.labels = getattr(options, 'labels', None)
        self.help_texts = getattr(options, 'help_texts', None)
        self.error_messages = getattr(options, 'error_messages', None)
        self.field_classes = getattr(options, 'field_classes', None)

From that list, I searched for each option on the docs page to find what I needed. Hope that helps someone.

๐Ÿ‘คdoctaphred

Leave a comment