2013-03-11 43 views
15

在Django文檔中,django.forms.models.ModelFormMeta選項的權威列表在哪裏? (例如,model,exclude,fields,widgets)我正在尋找相當於Model Meta OptionsDjango的ModelForm - Meta選項列表在哪裏?

+0

https://docs.djangoproject.com/en/dev/topics/forms/modelforms/ – catherine 2013-03-12 00:51:34

+0

謝謝@catherine。我看到了該頁面,但ModelForm Meta選項分散在整個頁面中,而不是像Model Meta Options頁面中的Meta選項那樣列出。但也許這是他們存在的唯一文檔? – 2013-03-12 06:49:07

+0

也許我們可以在Django中請求 – catherine 2013-03-12 06:57:41

回答

21

今天我自己有這個問題。爲了完整起見,這裏是當前存在的文檔:

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

而且從django/forms/models.py的摘錄:

class ModelFormOptions(object): 
    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) 

從這個名單,我搜索的文檔頁面上的每個選項,找到我需要。希望能幫助別人。

+0

請注意,在Django 1.6中添加了'labels','help_texts'和'error_messages' – 2014-12-19 12:37:56